public void Should_dispose_once() { var sut = new MyDisposableObject(); sut.Dispose(); sut.Dispose(); Assert.True(sut.IsDisposed); Assert.Equal(1, sut.DisposeCallCount); }
public void Should_throw_exception_when_disposed() { var sut = new MyDisposableObject(); sut.Dispose(); Assert.Throws <ObjectDisposedException>(() => sut.Ensure()); }