public void ReadLockDisposable_Unlock_IsIdempotent() { // Arrange using (var rwLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion)) using (var sut = new ReadLockDisposable(rwLock)) { // Act sut.Unlock(); // If an attempt to release the lock is made when one is not // acquired an exception will be thrown. sut.Unlock(); // Assert Assert.False(rwLock.IsReadLockHeld); } }
public void ReadLockDisposable_Unlock_IsIdempotent() { // Arrange using (var rwLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion)) using (var sut = new ReadLockDisposable(rwLock)) { // Act sut.Unlock(); // If an attempt to release the lock is made when one is not // acquired an exception will be thrown. sut.Unlock(); // Assert Assert.False(rwLock.IsReadLockHeld); } }