Skip to content

Commit

Permalink
Code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCiliaVincenti committed Jul 21, 2024
1 parent 6227379 commit 8de1be5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void IsInUseRaceConditionCoverage()
[Fact]
public void IsInUseKeyChangeRaceConditionCoverage()
{
var asyncKeyedLocker = new AsyncKeyedLocker<string>(o => o.PoolSize = 0);
var asyncKeyedLocker = new AsyncKeyedLocker<string>(o => o.PoolSize = 1);
var releaser = asyncKeyedLocker._dictionary._pool.GetObject("test");
asyncKeyedLocker._dictionary._pool.PutObject(releaser);
asyncKeyedLocker.Lock("test");
Expand All @@ -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]
Expand Down

0 comments on commit 8de1be5

Please sign in to comment.