コード例 #1
0
 public void ExceptionHandlerIsCalledWhenExceptionMatches_AlternateHandler()
 {
     ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
     ITest testCase = new ProxyTestCase("ThrowsArgumentException_AlternateHandler", fixture);
     testCase.Run();
     Assert.That(fixture.HandlerCalled, Is.False, "Base Handler should not be called");
     Assert.That(fixture.AlternateHandlerCalled, "Alternate Handler should be called");
 }
コード例 #2
0
 public void ExceptionHandlerIsNotCalledWhenExceptionDoesNotMatch()
 {
     ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
     ITest testCase = new ProxyTestCase("ThrowsApplicationException", fixture);
     testCase.Run();
     Assert.That(fixture.HandlerCalled, Is.False, "Base Handler should not be called");
     Assert.That(fixture.AlternateHandlerCalled, Is.False, "Alternate Handler should not be called");
 }
コード例 #3
0
        public void ExceptionHandlerIsCalledWhenExceptionMatches_AlternateHandler()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
            ITest testCase = new ProxyTestCase("ThrowsArgumentException_AlternateHandler", fixture);

            testCase.Run();
            Assert.That(fixture.HandlerCalled, Is.False, "Base Handler should not be called");
            Assert.That(fixture.AlternateHandlerCalled, "Alternate Handler should be called");
        }
コード例 #4
0
        public void ExceptionHandlerIsNotCalledWhenExceptionDoesNotMatch()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
            ITest testCase = new ProxyTestCase("ThrowsApplicationException", fixture);

            testCase.Run();
            Assert.That(fixture.HandlerCalled, Is.False, "Base Handler should not be called");
            Assert.That(fixture.AlternateHandlerCalled, Is.False, "Alternate Handler should not be called");
        }
コード例 #5
0
 public void FailsWhenAlternateHandlerIsNotFound()
 {
     ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
     ITest testCase = new ProxyTestCase("MethodWithBadHandler", fixture);
     TestResult result = testCase.Run();
     Assert.That(result.ResultState, Is.EqualTo(ResultState.Failure));
     Assert.That(result.Message, Is.EqualTo(
         "The specified exception handler DeliberatelyMissingHandler was not found" ));
 }
コード例 #6
0
        public void FailsWhenAlternateHandlerIsNotFound()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
            ITest      testCase = new ProxyTestCase("MethodWithBadHandler", fixture);
            TestResult result   = testCase.Run();

            Assert.That(result.ResultState, Is.EqualTo(ResultState.Failure));
            Assert.That(result.Message, Is.EqualTo(
                            "The specified exception handler DeliberatelyMissingHandler was not found"));
        }