Example #1
0
        public static Cargo NewCargo(TrackingId trackingId, Location origin, Location destination,
                                     DateTime arrivalDeadline)
        {
            var routeSpecification = new RouteSpecification(origin, destination, arrivalDeadline);

            return(new Cargo(trackingId, routeSpecification));
        }
Example #2
0
        public Cargo(TrackingId trackingId, RouteSpecification routeSpecification)
        {
            Validate.NotNull(trackingId, "Tracking ID is required");
            Validate.NotNull(routeSpecification, "Route specification is required");

            this.trackingId = trackingId;
            // Cargo origin never changes, even if the route specification changes.
            // However, at creation, cargo orgin can be derived from the initial route specification.
            origin = routeSpecification.Origin;
            this.routeSpecification = routeSpecification;

            delivery = Delivery.DerivedFrom(this.routeSpecification, itinerary, HandlingHistory.EMPTY);
        }