@@ -22,7 +22,7 @@ public ConcurrentSetTests()
22
22
[ TestMethod ]
23
23
public async Task ParallelWrites ( )
24
24
{
25
- ConcurrentIndexedSet < Person > sut = CreateSet ( ) ;
25
+ using ConcurrentIndexedSet < Person > sut = CreateSet ( ) ;
26
26
27
27
Task [ ] tasks = _testData . Select ( p => Task . Run ( ( ) => sut . Add ( p ) ) ) . ToArray ( ) ;
28
28
await Task . WhenAll ( tasks ) ;
@@ -33,7 +33,7 @@ public async Task ParallelWrites()
33
33
[ TestMethod ]
34
34
public async Task ParallelReads ( )
35
35
{
36
- ConcurrentIndexedSet < Person > sut = CreateSet ( ) ;
36
+ using ConcurrentIndexedSet < Person > sut = CreateSet ( ) ;
37
37
_ = sut . AddRange ( _testData ) ;
38
38
39
39
Task < bool > [ ] tasks = _testData . Select ( p => Task . Run ( ( ) => sut . TryGetSingle ( x => x . Phone , p . Phone , out _ ) ) ) . ToArray ( ) ;
@@ -44,7 +44,7 @@ public async Task ParallelReads()
44
44
[ TestMethod ]
45
45
public async Task ParallelReadsAndWrites ( )
46
46
{
47
- ConcurrentIndexedSet < Person > sut = CreateSet ( ) ;
47
+ using ConcurrentIndexedSet < Person > sut = CreateSet ( ) ;
48
48
_ = sut . AddRange ( _testData ) ;
49
49
50
50
Task < bool > [ ] tasks = _testData . Select ( ( p , i ) => Task . Run ( ( ) =>
@@ -59,7 +59,7 @@ public async Task ParallelReadsAndWrites()
59
59
[ TestMethod ]
60
60
public async Task Update_method_allows_to_execute_code_in_isolation ( )
61
61
{
62
- ConcurrentIndexedSet < int , TestData > sut = IndexedSetBuilder < TestData > . Create ( x => x . PrimaryKey )
62
+ using ConcurrentIndexedSet < int , TestData > sut = IndexedSetBuilder < TestData > . Create ( x => x . PrimaryKey )
63
63
. WithIndex ( x => x . IntProperty )
64
64
. BuildConcurrent ( ) ;
65
65
var element = new TestData ( 1 , 0 , GuidGen . Get ( 1 ) , "Test" ) ;
@@ -77,7 +77,7 @@ await Task.WhenAll(Enumerable.Range(0, 100).Select(__ => Task.Run(() => sut.Upda
77
77
[ TestMethod ]
78
78
public async Task Parallel_reads_and_writes_with_read_method ( )
79
79
{
80
- ConcurrentIndexedSet < int , TestData > sut = IndexedSetBuilder < TestData > . Create ( x => x . PrimaryKey )
80
+ using ConcurrentIndexedSet < int , TestData > sut = IndexedSetBuilder < TestData > . Create ( x => x . PrimaryKey )
81
81
. WithIndex ( x => x . IntProperty )
82
82
. WithIndex ( x => x . GuidProperty )
83
83
. BuildConcurrent ( ) ;
0 commit comments