public void TestRoutingStatus()
        {       
            Cargo cargo = new Cargo(new TrackingId("XYZ"),
                                    new RouteSpecification(SampleLocations.STOCKHOLM, SampleLocations.MELBOURNE,
                                                           DateTime.Now));
            var good = new Itinerary();
            var bad = new Itinerary();

            RouteSpecification acceptOnlyGood = new RouteSpecificationStub(cargo.Origin,
                                                                           cargo.RouteSpecification.Destination,
                                                                           DateTime.Now, good);             
            cargo.SpecifyNewRoute(acceptOnlyGood);

            Assert.AreEqual(RoutingStatus.NOT_ROUTED, cargo.Delivery.RoutingStatus);

            cargo.AssignToRoute(bad);
            Assert.AreEqual(RoutingStatus.MISROUTED, cargo.Delivery.RoutingStatus);

            cargo.AssignToRoute(good);
            Assert.AreEqual(RoutingStatus.ROUTED, cargo.Delivery.RoutingStatus);
        }
Esempio n. 2
0
        public void TestRoutingStatus()
        {
            Cargo cargo = new Cargo(new TrackingId("XYZ"),
                                    new RouteSpecification(SampleLocations.STOCKHOLM, SampleLocations.MELBOURNE,
                                                           DateTime.Now));
            var good = new Itinerary();
            var bad  = new Itinerary();

            RouteSpecification acceptOnlyGood = new RouteSpecificationStub(cargo.Origin,
                                                                           cargo.RouteSpecification.Destination,
                                                                           DateTime.Now, good);

            cargo.SpecifyNewRoute(acceptOnlyGood);

            Assert.AreEqual(RoutingStatus.NOT_ROUTED, cargo.Delivery.RoutingStatus);

            cargo.AssignToRoute(bad);
            Assert.AreEqual(RoutingStatus.MISROUTED, cargo.Delivery.RoutingStatus);

            cargo.AssignToRoute(good);
            Assert.AreEqual(RoutingStatus.ROUTED, cargo.Delivery.RoutingStatus);
        }