refactor: relocate options classes to dedicated Options folders
Move configuration options from Core/DataAccess/DataSync/ExcelIO to dedicated Options folders within each project for better organization. Update all references and tests accordingly.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using JdeScoping.Core.Options;
|
||||
using JdeScoping.Infrastructure.Options;
|
||||
using JdeScoping.Infrastructure.Auth;
|
||||
using JdeScoping.Infrastructure.Tests.Helpers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -52,19 +52,16 @@ public class LdapIntegrationTests
|
||||
{
|
||||
// Arrange
|
||||
var testUser = MockLdapServer.ValidGroupMemberUser;
|
||||
var ldapOptions = Options.Create(new LdapOptions
|
||||
var ldapOptions = Microsoft.Extensions.Options.Options.Create(new LdapOptions
|
||||
{
|
||||
ServerUrls = MockLdapServer.FakeServerUrls,
|
||||
GroupDn = MockLdapServer.TestGroupDn,
|
||||
SearchBase = MockLdapServer.TestSearchBase,
|
||||
ConnectionTimeoutSeconds = 1 // Fast timeout for test
|
||||
});
|
||||
var authOptions = Options.Create(new AuthOptions
|
||||
{
|
||||
ConnectionTimeoutSeconds = 1, // Fast timeout for test
|
||||
AdminBypassUsers = []
|
||||
});
|
||||
|
||||
var service = new LdapAuthService(ldapOptions, authOptions, _logger);
|
||||
var service = new LdapAuthService(ldapOptions, _logger);
|
||||
|
||||
// Act
|
||||
var result = await service.AuthenticateAsync(testUser.Username, testUser.Password);
|
||||
@@ -105,19 +102,16 @@ public class LdapIntegrationTests
|
||||
{
|
||||
// Arrange
|
||||
var testUser = MockLdapServer.ValidNotInGroupUser;
|
||||
var ldapOptions = Options.Create(new LdapOptions
|
||||
var ldapOptions = Microsoft.Extensions.Options.Options.Create(new LdapOptions
|
||||
{
|
||||
ServerUrls = MockLdapServer.FakeServerUrls,
|
||||
GroupDn = MockLdapServer.TestGroupDn,
|
||||
SearchBase = MockLdapServer.TestSearchBase,
|
||||
ConnectionTimeoutSeconds = 1
|
||||
});
|
||||
var authOptions = Options.Create(new AuthOptions
|
||||
{
|
||||
ConnectionTimeoutSeconds = 1,
|
||||
AdminBypassUsers = []
|
||||
});
|
||||
|
||||
var service = new LdapAuthService(ldapOptions, authOptions, _logger);
|
||||
var service = new LdapAuthService(ldapOptions, _logger);
|
||||
|
||||
// Act
|
||||
var result = await service.AuthenticateAsync(testUser.Username, testUser.Password);
|
||||
@@ -152,19 +146,16 @@ public class LdapIntegrationTests
|
||||
{
|
||||
// Arrange
|
||||
var testUser = MockLdapServer.InvalidCredentialsUser;
|
||||
var ldapOptions = Options.Create(new LdapOptions
|
||||
var ldapOptions = Microsoft.Extensions.Options.Options.Create(new LdapOptions
|
||||
{
|
||||
ServerUrls = MockLdapServer.FakeServerUrls,
|
||||
GroupDn = MockLdapServer.TestGroupDn,
|
||||
SearchBase = MockLdapServer.TestSearchBase,
|
||||
ConnectionTimeoutSeconds = 1
|
||||
});
|
||||
var authOptions = Options.Create(new AuthOptions
|
||||
{
|
||||
ConnectionTimeoutSeconds = 1,
|
||||
AdminBypassUsers = []
|
||||
});
|
||||
|
||||
var service = new LdapAuthService(ldapOptions, authOptions, _logger);
|
||||
var service = new LdapAuthService(ldapOptions, _logger);
|
||||
|
||||
// Act
|
||||
var result = await service.AuthenticateAsync(testUser.Username, testUser.Password);
|
||||
@@ -205,19 +196,16 @@ public class LdapIntegrationTests
|
||||
public async Task AuthenticateAsync_AllServersFail_ReturnsConnectionError()
|
||||
{
|
||||
// Arrange
|
||||
var ldapOptions = Options.Create(new LdapOptions
|
||||
var ldapOptions = Microsoft.Extensions.Options.Options.Create(new LdapOptions
|
||||
{
|
||||
ServerUrls = MockLdapServer.FakeServerUrls, // 3 fake servers that will all fail
|
||||
GroupDn = MockLdapServer.TestGroupDn,
|
||||
SearchBase = MockLdapServer.TestSearchBase,
|
||||
ConnectionTimeoutSeconds = 1 // Fast timeout for test
|
||||
});
|
||||
var authOptions = Options.Create(new AuthOptions
|
||||
{
|
||||
ConnectionTimeoutSeconds = 1, // Fast timeout for test
|
||||
AdminBypassUsers = []
|
||||
});
|
||||
|
||||
var service = new LdapAuthService(ldapOptions, authOptions, _logger);
|
||||
var service = new LdapAuthService(ldapOptions, _logger);
|
||||
|
||||
// Act
|
||||
var result = await service.AuthenticateAsync("anyuser", "anypassword");
|
||||
|
||||
Reference in New Issue
Block a user