public void ExceptionHandlerIsNotCalledWhenExceptionDoesNotMatch() { ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass(); TestBuilder.RunTestCase(fixture, "ThrowsException"); Assert.IsFalse(fixture.HandlerCalled, "Base Handler should not be called"); }
public void ExceptionHandlerIsCalledWhenExceptionMatches() { ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass(); TestBuilder.RunTestCase(fixture, "ThrowsArgumentException"); Assert.IsTrue(fixture.HandlerCalled, "Base Handler should be called"); }
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 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"); }
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"); }
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")); }
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.Properties.Get(PropertyNames.SkipReason)); }
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 ); }