public void should_construct_correctly_cargo()
        {
            var trackingId = new TrackingId("XYZ");
            var arrivalDeadline = new DateTime(2009, 3, 13);
            var routeSpecification = new RouteSpecification(_stockholm, _melbourne, arrivalDeadline);

            var cargo = new BookingApi.Domain.Cargo.Cargo(trackingId, routeSpecification);

            Assert.Equal(RoutingStatus.NotRouted, cargo.Delivery.RoutingStatus);
            Assert.Equal(TransportStatus.NotReceived, cargo.Delivery.TransportStatus);
            Assert.Equal(BookingApi.Domain.Location.Location.Unknown, cargo.Delivery.LastKnownLocation);
            Assert.Equal(BookingApi.Domain.Voyage.Voyage.Empty, cargo.Delivery.CurrentVoyage);
        }
Beispiel #2
0
        /// <summary>
        /// Creates new <see cref="Cargo"/> object with provided tracking id and route specification.
        /// </summary>
        /// <param name="trackingId">Tracking id of this cargo.</param>
        /// <param name="routeSpecification">Route specification.</param>
        public Cargo(TrackingId trackingId, RouteSpecification routeSpecification)
        {
            if (trackingId == null)
                throw new ArgumentNullException("trackingId");

            if (routeSpecification == null)
                throw new ArgumentNullException("routeSpecification");

            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.
            Origine = routeSpecification.Origin;
            RouteSpecification = routeSpecification;
            Delivery = Delivery.DerivedFrom(RouteSpecification, Itinerary, HandlingHistory.EmptyHistory);
        }
 public ItineraryTests()
 {
     _voyage = new VoyageBuilder(new VoyageNumber("0123"), _shanghai)
                                 .AddMovement(_rotterdam, DateTime.Now, DateTime.Now)
                                 .AddMovement(_gothenburg, DateTime.Now, DateTime.Now)
                                 .Build();
     _wrongVoyage = new VoyageBuilder(new VoyageNumber("666"), _newyork)
                                 .AddMovement(new BookingApi.Domain.Location.Location(UnLocodeHelpers.GetNewUnLocode(), "STOCKHOLM"), DateTime.Now, DateTime.Now)
                                 .AddMovement(_helsinki, DateTime.Now, DateTime.Now)
                                 .Build();
     _trackingId = new TrackingId("CARGO1");
     _routeSpecification = new RouteSpecification(_shanghai, _gothenburg, DateTime.Now);
     _cargo = new BookingApi.Domain.Cargo.Cargo(_trackingId, _routeSpecification);
     _itinerary = new Itinerary(new List<Leg>
                                	{
                                		new Leg(_voyage, _shanghai, DateTime.Now, _rotterdam, DateTime.Now),
                                     new Leg(_voyage, _rotterdam, DateTime.Now, _gothenburg, DateTime.Now)
                                	});
 }
 public HandlingEventTests()
 {
     var trackingId = new TrackingId("XYZ");
     _hongkong = new BookingApi.Domain.Location.Location(UnLocodeHelpers.GetNewUnLocode(), "HONGKONG");
     _newYork = new BookingApi.Domain.Location.Location(UnLocodeHelpers.GetNewUnLocode(), "NEW YORK");
     _helsinki = new BookingApi.Domain.Location.Location(UnLocodeHelpers.GetNewUnLocode(), "HELSINKI");
     _chicago = new BookingApi.Domain.Location.Location(UnLocodeHelpers.GetNewUnLocode(), "CHICAGO");
     _hambourg = new BookingApi.Domain.Location.Location(UnLocodeHelpers.GetNewUnLocode(), "HAMBOURG");
     var routeSpecification = new RouteSpecification(_hongkong, _newYork, DateTime.Now);
     _cargo = new BookingApi.Domain.Cargo.Cargo(trackingId, routeSpecification);
     _voyage = new VoyageBuilder(new VoyageNumber("X25"), _hongkong)
                                                                 .AddMovement(_newYork, DateTime.Now, DateTime.Now)
                                                                 .Build();
     _voyage2 = new VoyageBuilder(new VoyageNumber("CM004"), _newYork)
                                                                 .AddMovement(_chicago, DateTime.Now, DateTime.Now)
                                                                 .Build();
     _voyage3 = new VoyageBuilder(new VoyageNumber("CM005"), _chicago)
                                                                 .AddMovement(_hambourg, DateTime.Now, DateTime.Now)
                                                                 .Build();
 }