public void ThrowExceptionIfDisposedTest() { NoUnmanagedResources toDispose = new NoUnmanagedResources(); toDispose.Dispose(); Assert.Throws <ObjectDisposedException>(() => toDispose.PublicInstanceOperation()); }
public void OnDisposedTest() { // TODO: Create Assert method to test whether events are called. bool eventCalled = false; NoUnmanagedResources toDispose = new NoUnmanagedResources(); toDispose.OnDisposed += () => eventCalled = true; toDispose.Dispose(); Assert.True(eventCalled); }