diff --git a/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs b/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs index bdb54f0..fec44fe 100644 --- a/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs +++ b/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs @@ -238,7 +238,7 @@ public void IsInUseRaceConditionCoverage() [Fact] public void IsInUseKeyChangeRaceConditionCoverage() { - var asyncKeyedLocker = new AsyncKeyedLocker(o => o.PoolSize = 0); + var asyncKeyedLocker = new AsyncKeyedLocker(o => o.PoolSize = 1); var releaser = asyncKeyedLocker._dictionary._pool.GetObject("test"); asyncKeyedLocker._dictionary._pool.PutObject(releaser); asyncKeyedLocker.Lock("test"); @@ -255,7 +255,11 @@ public void TryIncrementNoPoolingCoverage() var timer = new System.Timers.Timer(1000); timer.Elapsed += (_, _) => { releaser.Dispose(); }; timer.Start(); - asyncKeyedLocker.Lock("test"); + using (asyncKeyedLocker.Lock("test")) + { + Assert.True(asyncKeyedLocker.IsInUse("test")); + } + Assert.False(asyncKeyedLocker.IsInUse("test")); } [Fact]