@@ -18,6 +18,15 @@ private static void AddExclusionDomain(string identifier) {
1818 excludedDomains . Add ( identifier ) ;
1919 }
2020
21+ private static void ResetExclusionDomain ( ) {
22+ var excludedDomainsField = typeof ( LdapConnectionPool )
23+ . GetField ( "ExcludedDomains" , BindingFlags . Static | BindingFlags . NonPublic ) ;
24+
25+ var excludedDomains = ( ConcurrentHashSet ) excludedDomainsField . GetValue ( null ) ;
26+
27+ excludedDomains . Clear ( ) ;
28+ }
29+
2130 private static ConcurrentBag < LdapConnectionWrapper > GetConnectionsBag ( LdapConnectionPool pool ) {
2231 var field = typeof ( LdapConnectionPool )
2332 . GetField ( "_connections" , BindingFlags . Instance | BindingFlags . NonPublic ) ;
@@ -33,6 +42,7 @@ private static ConcurrentBag<LdapConnectionWrapper> GetGlobalCatalogConnectionsB
3342 [ Fact ]
3443 public async Task LdapConnectionPool_ExcludedDomains_ShouldExitEarly ( )
3544 {
45+ ResetExclusionDomain ( ) ;
3646 var mockLogger = new Mock < ILogger > ( ) ;
3747 var ldapConfig = new LdapConfig ( ) ;
3848 var connectionPool = new ConnectionPoolManager ( ldapConfig , mockLogger . Object ) ;
@@ -47,6 +57,7 @@ public async Task LdapConnectionPool_ExcludedDomains_ShouldExitEarly()
4757 [ Fact ]
4858 public async Task LdapConnectionPool_ExcludedDomains_NonExcludedShouldntExit ( )
4959 {
60+ ResetExclusionDomain ( ) ;
5061 var mockLogger = new Mock < ILogger > ( ) ;
5162 var ldapConfig = new LdapConfig ( ) ;
5263 var connectionPool = new ConnectionPoolManager ( ldapConfig , mockLogger . Object ) ;
@@ -64,6 +75,7 @@ public async Task LdapConnectionPool_ExcludedDomains_NonExcludedShouldntExit()
6475 [ Fact ]
6576 public async Task LdapConnectionPool_ExcludedDomains_GlobalCatalog_ShouldExitEarly ( )
6677 {
78+ ResetExclusionDomain ( ) ;
6779 var mockLogger = new Mock < ILogger > ( ) ;
6880 var ldapConfig = new LdapConfig ( ) ;
6981 var connectionPool = new ConnectionPoolManager ( ldapConfig , mockLogger . Object ) ;
0 commit comments