[AZ-487] fix: resolve CS0104 ambiguity in AuthN tests

`AuthenticationServiceCollectionExtensions` is also a built-in
.NET type under `Microsoft.Extensions.DependencyInjection`. With
both namespaces imported the unqualified references in this test
file failed with CS0104, breaking the entire test project build.
Resolved via a `using` alias so the call sites stay short while
the build stays unambiguous.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-11 23:41:31 +03:00
parent 96cd3c4495
commit 753be43d11
@@ -8,6 +8,7 @@ using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using SatelliteProvider.Api.Authentication; using SatelliteProvider.Api.Authentication;
using SatelliteProvider.Tests.TestUtilities; using SatelliteProvider.Tests.TestUtilities;
using AuthExtensions = SatelliteProvider.Api.Authentication.AuthenticationServiceCollectionExtensions;
namespace SatelliteProvider.Tests.Authentication; namespace SatelliteProvider.Tests.Authentication;
@@ -18,13 +19,13 @@ public class AuthenticationServiceCollectionExtensionsTests : IDisposable
public AuthenticationServiceCollectionExtensionsTests() public AuthenticationServiceCollectionExtensionsTests()
{ {
_originalEnv = Environment.GetEnvironmentVariable(AuthenticationServiceCollectionExtensions.JwtSecretEnvVar); _originalEnv = Environment.GetEnvironmentVariable(AuthExtensions.JwtSecretEnvVar);
Environment.SetEnvironmentVariable(AuthenticationServiceCollectionExtensions.JwtSecretEnvVar, null); Environment.SetEnvironmentVariable(AuthExtensions.JwtSecretEnvVar, null);
} }
public void Dispose() public void Dispose()
{ {
Environment.SetEnvironmentVariable(AuthenticationServiceCollectionExtensions.JwtSecretEnvVar, _originalEnv); Environment.SetEnvironmentVariable(AuthExtensions.JwtSecretEnvVar, _originalEnv);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
@@ -122,7 +123,7 @@ public class AuthenticationServiceCollectionExtensionsTests : IDisposable
{ {
// Arrange // Arrange
const string envSecret = "env-secret-also-longer-than-thirty-two-bytes-for-hmac"; const string envSecret = "env-secret-also-longer-than-thirty-two-bytes-for-hmac";
Environment.SetEnvironmentVariable(AuthenticationServiceCollectionExtensions.JwtSecretEnvVar, envSecret); Environment.SetEnvironmentVariable(AuthExtensions.JwtSecretEnvVar, envSecret);
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddLogging(); services.AddLogging();
var configuration = BuildConfiguration(("Jwt:Secret", "config-secret-also-32-bytes-long-aaaaaaaaaa")); var configuration = BuildConfiguration(("Jwt:Secret", "config-secret-also-32-bytes-long-aaaaaaaaaa"));