Пример #1
0
        public void DisposableManagedObject_DisposeSetsIsDisposed()
        {
            var testObject = new MockDisposableObject();

            Assert.IsFalse(testObject.IsDisposed);
            testObject.Dispose();
            Assert.IsTrue(testObject.IsDisposed);
        }
Пример #2
0
        public void DisposableManagedObject_ThrowIfDisposedDoesWhatItSaysOnTheTin()
        {
            var testObject = new MockDisposableObject();
            var result     = testObject.TestMethod();

            Assert.AreEqual("oops", result);
            testObject.Dispose();
            result = testObject.TestMethod();
        }