diff --git a/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs b/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs index 0a57ac3..4617718 100644 --- a/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs +++ b/AsyncKeyedLock.Tests/AsyncKeyedLocker/OriginalTests.cs @@ -1,10 +1,7 @@ using AsyncKeyedLock.Tests.Helpers; using FluentAssertions; -using FluentAssertions.Common; using ListShuffle; -using System.Collections; using System.Collections.Concurrent; -using System.Collections.Generic; using Xunit; namespace AsyncKeyedLock.Tests.AsyncKeyedLocker @@ -139,6 +136,23 @@ public void TestDisposeDoesNotThrow() action.Should().NotThrow(); } + [Fact] + public void TestDisposeDoesNotThrowDespiteDisposedSemaphoreSlim() + { + Action action = () => + { + var asyncKeyedLocker = new AsyncKeyedLocker(o => + { + o.PoolSize = 20; + o.PoolInitialFill = 1; + }); + AsyncKeyedLockReleaser releaser = (AsyncKeyedLockReleaser)asyncKeyedLocker.Lock("test"); + releaser.SemaphoreSlim.Dispose(); + asyncKeyedLocker.Dispose(); + }; + action.Should().NotThrow(); + } + [Fact] public void TestIndexDoesNotThrow() {