Example #1
0
        public void return_the_continuation_if_the_handler_matches()
        {
            var exception = new Exception();
            var envelope  = ObjectMother.Envelope();

            var matchingCondition1 = MockRepository.GenerateMock <IExceptionMatch>();

            matchingCondition1.Stub(x => x.Matches(envelope, exception)).Return(true);

            var handler = new ErrorHandler();

            handler.AddCondition(matchingCondition1);
            handler.AddContinuation(MockRepository.GenerateMock <IContinuation>());

            handler.Matches(envelope, exception).ShouldBeTrue();

            handler.DetermineContinuation(envelope, exception)
            .ShouldBeTheSameAs(handler.Continuation(null, null));
        }
Example #2
0
        public void return_the_continuation_if_the_handler_matches()
        {
            var exception = new Exception();
            var envelope  = ObjectMother.Envelope();

            var matchingCondition1 = Substitute.For <IExceptionMatch>();

            matchingCondition1.Matches(envelope, exception).Returns(true);

            var handler = new ErrorHandler();

            handler.AddCondition(matchingCondition1);
            handler.AddContinuation(Substitute.For <IContinuation>());

            ShouldBeBooleanExtensions.ShouldBeTrue(handler.Matches(envelope, exception));

            handler.DetermineContinuation(envelope, exception)
            .ShouldBeTheSameAs(handler.Continuation(null, null));
        }