Ejemplo n.º 1
0
        public void updateCargo()
        {
            TrackingId         trackingId         = trackingIdFactory.nextTrackingId();
            RouteSpecification routeSpecification = new RouteSpecification(L.HONGKONG,
                                                                           L.GOTHENBURG,
                                                                           DateTime.Parse("2009-10-15"));

            Cargo cargo = new Cargo(trackingId, routeSpecification);

            cargoRepository.store(cargo);

            HandlingEvent handlingEvent = handlingEventFactory.createHandlingEvent(DateTime.Parse("2009-10-01 14:30"),
                                                                                   cargo.TrackingId,
                                                                                   V.HONGKONG_TO_NEW_YORK.VoyageNumber,
                                                                                   L.HONGKONG.UnLocode,
                                                                                   HandlingActivityType.LOAD,
                                                                                   new OperatorCode("ABCDE"));

            handlingEventRepository.store(handlingEvent);

            Assert.That(handlingEvent.Activity, Is.Not.EqualTo(cargo.MostRecentHandlingActivity));

            cargoUpdater.updateCargo(handlingEvent.SequenceNumber);

            Assert.That(handlingEvent.Activity, Is.EqualTo(cargo.MostRecentHandlingActivity));
            Assert.True(handlingEvent.Activity != cargo.MostRecentHandlingActivity);

            systemEvents.AssertWasCalled(se => se.notifyOfCargoUpdate(cargo));
        }
        public void setupCargo()
        {
            TrackingIdFactoryInMem trackingIdFactory = new TrackingIdFactoryInMem();

            // Creating new voyages to avoid rescheduling shared ones, breaking other tests
            voyage1 = new Voyage(new VoyageNumber("V1"), V.HONGKONG_TO_NEW_YORK.Schedule);
            voyage2 = new Voyage(new VoyageNumber("V2"), V.NEW_YORK_TO_DALLAS.Schedule);
            voyage3 = new Voyage(new VoyageNumber("V3"), V.DALLAS_TO_HELSINKI.Schedule);

            TrackingId         trackingId         = trackingIdFactory.nextTrackingId();
            RouteSpecification routeSpecification = new RouteSpecification(L.HANGZOU,
                                                                           L.STOCKHOLM,
                                                                           DateTime.Parse("2008-12-23"));

            cargo = new Cargo(trackingId, routeSpecification);
            Itinerary itinerary = new Itinerary(Leg.DeriveLeg(voyage1, L.HANGZOU, L.NEWYORK),
                                                Leg.DeriveLeg(voyage2, L.NEWYORK, L.DALLAS),
                                                Leg.DeriveLeg(voyage3, L.DALLAS, L.STOCKHOLM));

            cargo.AssignToRoute(itinerary);
        }