Ejemplo n.º 1
0
        public void if_attempts_are_under_the_threshold_try_the_exception_rules_with_aggregate()
        {
            theInnerBehaviorThrowsAggregateExceptionWith <NullReferenceException, NotImplementedException, NotSupportedException>();

            theEnvelope.Attempts     = 1;
            theChain.MaximumAttempts = 3;

            var rule = new FakeExceptionRule <NotImplementedException>();

            theChain.ErrorHandlers.Add(rule);

            ClassUnderTest.Invoke();

            theContinuationSetByTheErrorHandler().ShouldBeTheSameAs(rule.Continuation);
        }
Ejemplo n.º 2
0
        public void chooses_the_first_non_null_continuation_from_an_error_handler_3_with_aggregate()
        {
            var rule1 = new FakeExceptionRule <NotImplementedException>();
            var rule2 = new FakeExceptionRule <NotSupportedException>();
            var rule3 = new FakeExceptionRule <NotFiniteNumberException>();

            theEnvelope.Attempts     = 1;
            theChain.MaximumAttempts = 3;

            theChain.ErrorHandlers.Add(rule1);
            theChain.ErrorHandlers.Add(rule2);
            theChain.ErrorHandlers.Add(rule3);

            theInnerBehaviorThrowsAggregateExceptionWith <Exception, NotFiniteNumberException, ApplicationException>();

            ClassUnderTest.Invoke();

            theContinuationSetByTheErrorHandler().ShouldBeTheSameAs(rule3.Continuation);
        }
Ejemplo n.º 3
0
        public void none_of_the_rules_match_so_it_goes_to_the_error_queue_with_aggregate()
        {
            var rule1 = new FakeExceptionRule <NotImplementedException>();
            var rule2 = new FakeExceptionRule <NotSupportedException>();
            var rule3 = new FakeExceptionRule <NotFiniteNumberException>();

            theEnvelope.Attempts     = 1;
            theChain.MaximumAttempts = 3;

            theChain.ErrorHandlers.Add(rule1);
            theChain.ErrorHandlers.Add(rule2);
            theChain.ErrorHandlers.Add(rule3);

            theInnerBehaviorThrowsAggregateExceptionWith <Exception, ApplicationException, DBConcurrencyException>();

            ClassUnderTest.Invoke();

            var continuation = theContinuationSetByTheErrorHandler()
                               .ShouldBeOfType <MoveToErrorQueue>();

            continuation.Exception.ShouldBeOfType <AggregateException>();
        }