Skip to content

Commit

Permalink
Fixed test for more code coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCiliaVincenti committed Jan 14, 2024
1 parent 9e8f0b6 commit b83bb2f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,18 @@ public void TestLockAndTimeoutAndCancellationToken()
var asyncNonKeyedLocker = new AsyncNonKeyedLocker();
Assert.Equal(0, asyncNonKeyedLocker.GetRemainingCount());
Assert.Equal(1, asyncNonKeyedLocker.GetCurrentCount());
using (var myLock = asyncNonKeyedLocker.Lock(TimeSpan.FromMilliseconds(0), CancellationToken.None, out bool entered))
using (var myLock = asyncNonKeyedLocker.Lock(0, CancellationToken.None, out bool entered))
{
Assert.True(entered);
Assert.Equal(1, asyncNonKeyedLocker.GetRemainingCount());
Assert.Equal(0, asyncNonKeyedLocker.GetCurrentCount());
}
using (var myLock = asyncNonKeyedLocker.Lock(Timeout.Infinite, CancellationToken.None, out bool entered))
using (var myLock = asyncNonKeyedLocker.Lock(Timeout.InfiniteTimeSpan, CancellationToken.None, out bool entered))
{
Assert.True(entered);
Assert.Equal(1, asyncNonKeyedLocker.GetRemainingCount());
Assert.Equal(0, asyncNonKeyedLocker.GetCurrentCount());
using (var myLock2 = asyncNonKeyedLocker.Lock(TimeSpan.FromMilliseconds(0), CancellationToken.None, out entered))
using (var myLock2 = asyncNonKeyedLocker.Lock(0, CancellationToken.None, out entered))
{
Assert.False(entered);
Assert.False(((AsyncNonKeyedLockTimeoutReleaser)myLock2).EnteredSemaphore);
Expand Down

0 comments on commit b83bb2f

Please sign in to comment.