public static ReaderWriterLockSpy MustNotHaveUsedWriteLock(this ReaderWriterLockSpy spy) { if (spy.EnterWriteLockCount != 0 || spy.ExitWriteLockCount != 0) { throw new XunitException($"The lock should not have been used in write mode, but was actually entered {spy.EnterWriteLockCount} times and exited {spy.ExitWriteLockCount} times."); } return(spy); }
public static ReaderWriterLockSpy MustHaveUsedReadLockExactlyOnce(this ReaderWriterLockSpy spy) { if (spy.EnterReadLockCount != 1 || spy.ExitReadLockCount != 1) { throw new XunitException($"The lock should be used to enter and exit in read mode exactly once, but was actually entered {spy.EnterReadLockCount} times and exited {spy.ExitReadLockCount} times."); } return(spy); }
public static ReaderWriterLockSpy MustHaveBeenDisposed(this ReaderWriterLockSpy spy) { spy.DisposeCount.Should().BeGreaterOrEqualTo(1); return(spy); }