public void should_correctly_route_cargo() { var cargo = new BookingApi.Domain.Cargo.Cargo(new TrackingId("XYZ"), new RouteSpecification(_stockholm, _melbourne, DateTime.Now)); var good = new Itinerary(new List<Leg> { new Leg(BookingApi.Domain.Voyage.Voyage.Empty, _stockholm, DateTime.Now, _melbourne, DateTime.Now) }); // modif refactoring var bad = new Itinerary(new List<Leg> { new Leg(BookingApi.Domain.Voyage.Voyage.Empty, _hongkong, DateTime.Now, _hambourg, DateTime.Now) }); // modif refactoring var acceptOnlyGood = new FakeRouteSpecification(cargo.Origine, cargo.RouteSpecification.Destination, DateTime.Now, good); cargo.SpecifyNewRoute(acceptOnlyGood); Assert.Equal(RoutingStatus.NotRouted, cargo.Delivery.RoutingStatus); cargo.AssignToRoute(bad); Assert.Equal(RoutingStatus.Misrouted, cargo.Delivery.RoutingStatus); cargo.AssignToRoute(good); Assert.Equal(RoutingStatus.Routed, cargo.Delivery.RoutingStatus); }
private BookingApi.Domain.Cargo.Cargo SetUpCargoWithItinerary(BookingApi.Domain.Location.Location origin, BookingApi.Domain.Location.Location midpoint, BookingApi.Domain.Location.Location destination) { var cargo = new BookingApi.Domain.Cargo.Cargo(new TrackingId("CARGO1"), new RouteSpecification(origin, destination, DateTime.Now)); var itinerary = new Itinerary(new List<Leg> { new Leg(_voyage, origin, DateTime.Now, midpoint, DateTime.Now), new Leg(_voyage, midpoint, DateTime.Now, destination, DateTime.Now) }); cargo.AssignToRoute(itinerary); return cargo; }