public void Should_complete_route()
        {
            var routingSlip = new RoutingSlipBuilder().CreateRoutingSlip(Guid.NewGuid(), "foo", "bar");

            var bus = new Bus();
            var router = new Router(bus);

            router.SendToNextStep(null, routingSlip);
            
            bus.CurrentMessageContext.Headers.Clear();
            
            router.SendToNextStep(null, routingSlip);

            bus.CurrentMessageContext.Headers.ContainsKey(Router.RoutingSlipHeaderKey).ShouldBeFalse();

            routingSlip.Itinerary.Count.ShouldEqual(0);
            routingSlip.Log.Count.ShouldEqual(2);
            routingSlip.Log[0].Address.ShouldEqual("foo");

            bus.Forwarded.Count().ShouldEqual(1);

        }
        public void Should_send_to_next_destination_if_no_error()
        {
            var routingSlip = new RoutingSlipBuilder().CreateRoutingSlip(Guid.NewGuid(), "foo", "bar");

            var bus = new Bus();
            var router = new Router(bus);

            router.SendToNextStep(null, routingSlip);

            bus.CurrentMessageContext.Headers[Router.RoutingSlipHeaderKey].ShouldNotBeNull();

            routingSlip.Itinerary.Count.ShouldEqual(1);
            routingSlip.Log.Count.ShouldEqual(1);
            routingSlip.Log[0].Address.ShouldEqual("foo");

            bus.Forwarded.Count().ShouldEqual(1);
            bus.Forwarded.ShouldContain("bar");
        }
        public void Should_not_send_to_next_destination_if_error()
        {
            var routingSlip = new RoutingSlipBuilder().CreateRoutingSlip(Guid.NewGuid(), "foo", "bar");

            var bus = new Bus();
            var router = new Router(bus);

            router.SendToNextStep(new Exception(), routingSlip);

            bus.CurrentMessageContext.Headers.ContainsKey(Router.RoutingSlipHeaderKey).ShouldBeFalse();

            routingSlip.Itinerary.Count.ShouldEqual(2);
            routingSlip.Log.Count.ShouldEqual(0);

            bus.Forwarded.Count().ShouldEqual(0);
        }