public override AppleException Handle(TSrc src)
            {
                Console.WriteLine($"Handled Exception of type: {src.GetType()} with message: {src.Message}");

                WasHandled = true;
                var next = new AppleException(src.Message);

                return(next);
            }
Exemplo n.º 2
0
        public void WithoutTerminator_ShouldYieldUnterminatedPolicyBuilder()
        {
            var context = "some_context";

            var tail = new PolicyBuilderTail <AppleException, PearException>
                           (context, new Dictionary <Type, Type>
            {
                {
                    typeof(AppleException),
                    typeof(FruitGeneralizationExceptionHandler)
                }
            });

            var policy = tail.WithoutTerminator();

            var input = new AppleException();

            policy.Context.Should().Be(context);
            policy.CreatePolicy().Handle(new DefaultResolver(), input).Should().BeOfType <FruitException>();
        }