Inheritance: TrackingIdFactory
Ejemplo n.º 1
0
 public void setUp()
 {
     systemEvents = MockRepository.GenerateMock<SystemEvents>();
     cargoRepository = new CargoRepositoryInMem();
     handlingEventRepository = new HandlingEventRepositoryInMem();
     locationRepository = new LocationRepositoryInMem();
     voyageRepository = new VoyageRepositoryInMem();
     trackingIdFactory = new TrackingIdFactoryInMem();
     handlingEventFactory = new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);
     cargoUpdater = new CargoUpdater(systemEvents, cargoRepository, handlingEventRepository);
 }
        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);
        }