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"); }
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"); }
public void ExceptionHandlerIsCalledWhenExceptionMatches() { ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass(); ITest testCase = new ProxyTestCase("ThrowsArgumentException", fixture); testCase.Run(); Assert.That(fixture.HandlerCalled, Is.True, "Base Handler should be called"); Assert.That(fixture.AlternateHandlerCalled, Is.False, "Alternate Handler should be called"); }
public void ExceptionHandlerIsNotCalledWhenExceptionDoesNotMatch_AlternateHandler() { ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass(); ITest testCase = new ProxyTestCase("ThrowsApplicationException_AlternateHandler", 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"); }
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" )); }
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")); }