Пример #1
0
        public void ExceptionHandlerIsNotCalledWhenExceptionDoesNotMatch()
        {
            ExceptionHandlerCalledClass fixture = new ExceptionHandlerCalledClass();

            TestBuilder.RunTestCase(fixture, "ThrowsException");
            Assert.IsFalse(fixture.HandlerCalled, "Base Handler should not be called");
        }
Пример #2
0
        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");
 }
Пример #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 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");
 }
Пример #6
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");
 }
Пример #7
0
        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");
        }
Пример #8
0
        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");
        }
Пример #9
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" ));
 }
Пример #10
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"));
        }
        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));
        }
Пример #12
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 );
		}