示例#1
0
        public void setUp()
        {
            reportSubmission = MockRepository.GenerateMock <ReportSubmission>();
            CargoRepository         cargoRepository         = new CargoRepositoryInMem();
            HandlingEventRepository handlingEventRepository = new HandlingEventRepositoryInMem();
            HandlingEventFactory    handlingEventFactory    = new HandlingEventFactory(cargoRepository,
                                                                                       new VoyageRepositoryInMem(),
                                                                                       new LocationRepositoryInMem());

            TrackingId         trackingId         = new TrackingId("ABC");
            RouteSpecification routeSpecification = new RouteSpecification(L.HONGKONG, L.ROTTERDAM, DateTime.Parse("2009-10-10"));
            Cargo cargo = new Cargo(trackingId, routeSpecification);

            cargoRepository.store(cargo);

            HandlingEvent handlingEvent = handlingEventFactory.createHandlingEvent(
                DateTime.Parse("2009-10-02"),
                trackingId,
                null,
                L.HONGKONG.UnLocode,
                HandlingActivityType.RECEIVE,
                new OperatorCode("ABCDE")
                );

            handlingEventRepository.store(handlingEvent);

            cargo.Handled(handlingEvent.Activity);

            reportPusher        = new ReportPusher(reportSubmission, cargoRepository, handlingEventRepository);
            eventSequenceNumber = handlingEvent.SequenceNumber;
        }
        public void SetUp()
        {
            routingService = new RoutingServiceImpl();

            applicationEvents = new SynchronousApplicationEventsStub();

            // In-memory implementations of the repositories
            handlingEventRepository = new HandlingEventRepositoryInMem();
            cargoRepository = new CargoRepositoryInMem();
            locationRepository = new LocationRepositoryInMem();
            voyageRepository = new VoyageRepositoryInMem();

            // Actual factories and application services, wired with stubbed or in-memory infrastructure
            handlingEventFactory = new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);

            cargoInspectionService = new CargoInspectionService(applicationEvents, cargoRepository,
                                                                handlingEventRepository);
            handlingEventService = new HandlingEventService(handlingEventRepository, applicationEvents,
                                                            handlingEventFactory);
            bookingService = new BookingService(cargoRepository, locationRepository, routingService);

            // Circular dependency when doing synchrounous calls
            ((SynchronousApplicationEventsStub) applicationEvents).SetCargoInspectionService(cargoInspectionService);
        }
示例#3
0
        public void SetUp()
        {
            routingService = new RoutingServiceImpl();

            applicationEvents = new SynchronousApplicationEventsStub();

            // In-memory implementations of the repositories
            handlingEventRepository = new HandlingEventRepositoryInMem();
            cargoRepository         = new CargoRepositoryInMem();
            locationRepository      = new LocationRepositoryInMem();
            voyageRepository        = new VoyageRepositoryInMem();

            // Actual factories and application services, wired with stubbed or in-memory infrastructure
            handlingEventFactory = new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);

            cargoInspectionService = new CargoInspectionService(applicationEvents, cargoRepository,
                                                                handlingEventRepository);
            handlingEventService = new HandlingEventService(handlingEventRepository, applicationEvents,
                                                            handlingEventFactory);
            bookingService = new BookingService(cargoRepository, locationRepository, routingService);

            // Circular dependency when doing synchrounous calls
            ((SynchronousApplicationEventsStub)applicationEvents).SetCargoInspectionService(cargoInspectionService);
        }