예제 #1
0
        public void ThrowExceptionIfDisposedTest()
        {
            NoUnmanagedResources toDispose = new NoUnmanagedResources();

            toDispose.Dispose();

            Assert.Throws <ObjectDisposedException>(() => toDispose.PublicInstanceOperation());
        }
예제 #2
0
        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);
        }