public void ThrowsObjectDisposedException_WhenDisposedTwice() { var subject = new DisposableCallback(() => { }); subject.Dispose(); Assert.Throws <ObjectDisposedException>(() => subject.Dispose()); }
public void WhenCalledTwice_ThenThrowsObjectDisposedException() { var subject = new DisposableCallback("Test", () => { }); subject.Dispose(); Assert.Throws <ObjectDisposedException>(() => subject.Dispose()); }
public void WhenCalledTwice_ThenThrowsObjectDisposedException() { var subject = new DisposableCallback( $"{nameof(DisposeTests)}.{nameof(WhenCalledTwice_ThenThrowsObjectDisposedException)}", () => { }); subject.Dispose(); Assert.Throws <ObjectDisposedException>(() => subject.Dispose()); }
public void WhenCalled_ThenCallsActionPassedInConstructor() { bool wasCalled = false; Action action = () => wasCalled = true; var subject = new DisposableCallback("Test", action); Assert.False(wasCalled); subject.Dispose(); Assert.True(wasCalled); }