Пример #1
0
 public void ExceptionHandlerIsCalledWhenExceptionMatches_AlternateHandler()
 {
     ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
     ITest testCase = new TestCase("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 TestCase("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 FailsWhenAlternateHandlerIsNotFound()
 {
     ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();
     ITest testCase = new TestCase("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" ));
 }