public void CallProtectedMethodDisposingUnmanagedResourcesWhenUserCodeCallsDispose() { DisposableObjectStub stub = new DisposableObjectStub(); stub.Dispose(); Assert.That(stub.IsDisposingUnmanagedResourcesCalled, Is.True); }
public void CallProtectedMethodOnDisposingWhenUserCodeCallsDispose() { DisposableObjectStub stub = new DisposableObjectStub(); stub.Dispose(); Assert.That(stub.IsOnDisposingBeenCalled, Is.True); }
public void OnlyCallProtectedMethodDisposingUnmanagedResourcesWhenFinaliserCallsDispose() { DisposableObjectStub stub = new DisposableObjectStub(); stub.InvokePrivateMethod("Dispose", new[] { typeof(bool) }, false); Assert.That(stub.IsDisposingUnmanagedResourcesCalled, Is.True); Assert.That(stub.IsDisposingManagedResourcesCalled, Is.False); }
public void RaiseDisposedWhenDisposedWhenUserCodeCallsDispose() { GenericEventListener<EventArgs> testHelper = new GenericEventListener<EventArgs>(); using (DisposableObjectStub stub = new DisposableObjectStub()) { stub.Disposed += testHelper.Listen; } Assert.That(testHelper.HasBeenRaised, Is.True); Assert.That(testHelper.RaiseCounter, Is.EqualTo(1)); }
public void ReturnTrueWhenHittingIsDisposedGivenTheObjectIsDisposed() { DisposableObjectStub stub = new DisposableObjectStub(); stub.Dispose(); Assert.That(stub.IsDisposed, Is.True); }