Inheritance: LocationRepository
        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) {
      }
    });*/
        }
Ejemplo n.º 2
0
        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);
        }