protected void setUp() { LocationRepository locationRepository = new LocationRepositoryInMem(); voyageRepository = MockRepository.GenerateMock <VoyageRepository>(); GraphTraversalService graphTraversalService = MockRepository.GenerateMock <GraphTraversalService>(); graphTraversalService.Expect(s => s.findShortestPath( Arg <string> .Is.TypeOf, Arg <string> .Is.TypeOf, Arg <Hashtable> .Is.TypeOf)).Return(new List <TransitPath>()); graphTraversalService.Replay(); // TODO expectations on GTS externalRoutingService = new ExternalRoutingService(graphTraversalService, locationRepository, voyageRepository); /*new GraphTraversalServiceImpl(new GraphDAO() { * public List<String> listLocations() { * return Arrays.asList(TOKYO.unLocode().stringValue(), STOCKHOLM.unLocode().stringValue(), GOTHENBURG.unLocode().stringValue()); * } * * public void storeCarrierMovementId(String cmId, String from, String to) { * } * });*/ }
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() { ILocationRepository locationRepository = new LocationRepositoryInMem(); voyageRepositoryMock = new Mock<IVoyageRepository>(); voyageRepository = voyageRepositoryMock.Object; var daoTest = new Mock<GraphDAO>(); daoTest.CallBase = true; daoTest.Setup(d => d.ListLocations()).Returns(new List<string>() { SampleLocations.TOKYO.UnLocode.IdString, SampleLocations.STOCKHOLM.UnLocode.IdString, SampleLocations.GOTHENBURG.UnLocode.IdString }); IGraphTraversalService graphTraversalService = new GraphTraversalService(daoTest.Object); externalRoutingService = new ExternalRoutingService(graphTraversalService, locationRepository, voyageRepository); }
public void SetUp() { ILocationRepository locationRepository = new LocationRepositoryInMem(); voyageRepositoryMock = new Mock <IVoyageRepository>(); voyageRepository = voyageRepositoryMock.Object; var daoTest = new Mock <GraphDAO>(); daoTest.CallBase = true; daoTest.Setup(d => d.ListLocations()).Returns(new List <string>() { SampleLocations.TOKYO.UnLocode.IdString, SampleLocations.STOCKHOLM.UnLocode.IdString, SampleLocations.GOTHENBURG.UnLocode.IdString }); IGraphTraversalService graphTraversalService = new GraphTraversalService(daoTest.Object); externalRoutingService = new ExternalRoutingService(graphTraversalService, locationRepository, voyageRepository); }
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); }