public void fromRouteCandidateDTO() { var legs = new List <LegDTO>(); legs.Add(new LegDTO("PAC1", "CNHKG", "USLBG", DateTime.Now, DateTime.Now)); legs.Add(new LegDTO("CNT1", "USLBG", "USNYC", DateTime.Now, DateTime.Now)); var locationRepository = new LocationRepositoryInMem(); var voyageRepository = new VoyageRepositoryInMem(); // Tested call var itinerary = DTOAssembler.fromDTO(new RouteCandidateDTO(legs), voyageRepository, locationRepository); Assert.NotNull(itinerary); Assert.NotNull(itinerary.Legs); Assert.AreEqual(2, itinerary.Legs.Count()); var leg1 = itinerary.Legs.ElementAt(0); Assert.NotNull(leg1); Assert.AreEqual(L.HONGKONG, leg1.LoadLocation); Assert.AreEqual(L.LONGBEACH, leg1.UnloadLocation); var leg2 = itinerary.Legs.ElementAt(1); Assert.NotNull(leg2); Assert.AreEqual(L.LONGBEACH, leg2.LoadLocation); Assert.AreEqual(L.NEWYORK, leg2.UnloadLocation); }
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); }
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); }