Esempio n. 1
0
        public void ExceptionHandlerIsNotCalledWhenExceptionDoesNotMatch_AlternateHandler()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
            Test test = TestBuilder.MakeTestCase(fixture, "ThrowsApplicationException_AlternateHandler");

            test.Run(NullListener.NULL);
            Assert.IsFalse(fixture.HandlerCalled, "Base Handler should not be called");
            Assert.IsFalse(fixture.AlternateHandlerCalled, "Alternate Handler should not be called");
        }
Esempio n. 2
0
        public void ExceptionHandlerIsCalledWhenExceptionMatches()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
            Test test = TestBuilder.MakeTestCase(fixture, "ThrowsArgumentException");

            test.Run(NullListener.NULL);
            Assert.IsTrue(fixture.HandlerCalled, "Base Handler should be called");
            Assert.IsFalse(fixture.AlternateHandlerCalled, "Alternate Handler should not be called");
        }
Esempio n. 3
0
        public void TestIsNotRunnableWhenAlternateHandlerIsNotFound()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
            Test test = TestBuilder.MakeTestCase(fixture, "MethodWithBadHandler");

            Assert.AreEqual(RunState.NotRunnable, test.RunState);
            Assert.AreEqual(
                "The specified exception handler DeliberatelyMissingHandler was not found",
                test.IgnoreReason);
        }