Пример #1
0
        public void EnsuresNotDisposedCanBeValidated()
        {
            Ensures.NotDisposed(false, "TestObject");
            Ensures.NotDisposed <InvariantViolationException>(false, "TestObject");
            Ensures <InvariantViolationException> .NotDisposed(false, "TestObject");

            Assert.Throws <ObjectDisposedException>(() => Ensures.NotDisposed(true, "TestObject"));
            Assert.Throws <InvariantViolationException>(() => Ensures.NotDisposed <InvariantViolationException>(true, "TestObject"));
            Assert.Throws <InvariantViolationException>(() => Ensures <InvariantViolationException> .NotDisposed(true, "TestObject"));
        }