11using System . Collections . Immutable ;
22using Xunit ;
3- using Xunit . Abstractions ;
43
54namespace Ydb . Sdk . Ado . Tests ;
65
76[ Collection ( "PoolManagerTests" ) ]
87[ CollectionDefinition ( "PoolManagerTests" , DisableParallelization = true ) ]
98public class PoolManagerTests
109{
11- private readonly ITestOutputHelper _testOutputHelper ;
12-
13- public PoolManagerTests ( ITestOutputHelper testOutputHelper )
14- {
15- _testOutputHelper = testOutputHelper ;
16- }
17-
1810 [ Theory ]
1911 [ InlineData ( new [ ]
2012 {
@@ -36,6 +28,8 @@ public PoolManagerTests(ITestOutputHelper testOutputHelper)
3628 public async Task PoolManager_CachingAndCleanup ( string [ ] connectionStrings , int expectedDrivers , int expectedPools )
3729 {
3830 await YdbConnection . ClearAllPools ( ) ;
31+ foreach ( var ( _, driver ) in PoolManager . Drivers )
32+ Assert . True ( driver . IsDisposed ) ;
3933 PoolManager . Drivers . Clear ( ) ;
4034
4135 var connections = connectionStrings
@@ -53,27 +47,24 @@ public async Task PoolManager_CachingAndCleanup(string[] connectionStrings, int
5347 await Task . WhenAll ( parallelTasks ) ;
5448
5549 foreach ( var ( _, driver ) in PoolManager . Drivers )
56- {
5750 Assert . False ( driver . IsDisposed ) ;
58- }
5951
6052 Assert . Equal ( expectedDrivers , PoolManager . Drivers . Count ) ;
6153 Assert . Equal ( expectedPools , PoolManager . Pools . Count ) ;
6254
6355 await ClearAllConnections ( connections ) ;
6456 }
6557
66- private async Task ClearAllConnections ( IReadOnlyCollection < YdbConnection > connections )
58+ private static async Task ClearAllConnections ( IReadOnlyCollection < YdbConnection > connections )
6759 {
6860 foreach ( var connection in connections )
6961 await connection . CloseAsync ( ) ;
7062
7163 await YdbConnection . ClearAllPools ( ) ;
7264 Assert . Empty ( PoolManager . Pools ) ;
7365
74- foreach ( var ( str , driver ) in PoolManager . Drivers )
66+ foreach ( var ( _ , driver ) in PoolManager . Drivers )
7567 {
76- _testOutputHelper . WriteLine ( str ) ;
7768 Assert . True ( driver . IsDisposed ) ;
7869 }
7970 }
0 commit comments