Esempio n. 1
0
        public void IsDisposedShouldBeTrue()
        {
            var stub = new DisposableObjectStub();

            stub.Dispose();

            Assert.That(stub.IsDisposed, Is.True);
        }
Esempio n. 2
0
        public void DisposingUnmanagedResourcesShouldBeCalled()
        {
            var stub = new DisposableObjectStub();

            stub.Dispose();

            Assert.That(stub.IsDisposingUnmanagedResourcesCalled, Is.True);
        }
Esempio n. 3
0
        public void DisposingShouldBeFired()
        {
            var testHelper = new GenericEventListener<EventArgs>();

            using (var stub = new DisposableObjectStub())
            {
                stub.Disposing += testHelper.Listen;
            }

            Assert.That(testHelper.HasBeenRaised, Is.True);
            Assert.That(testHelper.RaiseCounter, Is.EqualTo(1));
        }
Esempio n. 4
0
        public void OnDisposingShouldBeCalled()
        {
            var stub = new DisposableObjectStub();

            stub.Dispose();

            Assert.That(stub.IsOnDisposingBeenCalled, Is.True);
        }
Esempio n. 5
0
        public void OnlyDisposingUnmanagedResourcesShouldBeCalled()
        {
            var stub = new DisposableObjectStub();

            stub.InvokePrivateMethod("Dispose", new[] { typeof(bool) }, false);

            Assert.That(stub.IsDisposingUnmanagedResourcesCalled, Is.True);
            Assert.That(stub.IsDisposingManagedResourcesCalled, Is.False);
        }