Exemplo n.º 1
0
        public void Ctor_SetsWaypoints()
        {
            var sut = new OptimizeRouteCriteria("start address", "end addres",
                                                new List <OptimizeRouteWaypoint> {
                new OptimizeRouteWaypoint(50, 50, Guid.NewGuid())
            });

            sut.Waypoints.Count.ShouldBe(1);
        }
Exemplo n.º 2
0
        public void Ctor_EncodesEndAddress()
        {
            var sut = new OptimizeRouteCriteria("start address", "end address",
                                                new List <OptimizeRouteWaypoint> {
                new OptimizeRouteWaypoint(50, 50, Guid.NewGuid())
            });

            sut.EndAddress.ShouldBe("end%20address");
        }
Exemplo n.º 3
0
 public GoogleOptimizeRouteServiceShould()
 {
     _optimiseRouteCriteria = new OptimizeRouteCriteria(
         "24 Sussex Drive Ottawa ON",
         "200 Sussex Drive Ottawa ON",
         new List <OptimizeRouteWaypoint>
     {
         new OptimizeRouteWaypoint(45.4, -75, _requestId1),
         new OptimizeRouteWaypoint(46, -75, _requestId2),
         new OptimizeRouteWaypoint(46.1, -75, _requestId3)
     }
         );
 }
        public async Task CallOptimizeRouteService_WhenStartAndEndAddressPresent_WithCorrectCriteria()
        {
            OptimizeRouteCriteria criteria = null;

            var optimizeRouteService = new Mock <IOptimizeRouteService>();

            optimizeRouteService.Setup(x => x.OptimizeRoute(It.IsAny <OptimizeRouteCriteria>()))
            .ReturnsAsync(new OptimizeRouteResult())
            .Callback <OptimizeRouteCriteria>(x => criteria = x)
            .Verifiable();

            var sut = new OptimizeRouteCommandHandler(Context, optimizeRouteService.Object, Mock.Of <IMemoryCache>());

            await sut.Handle(new OptimizeRouteCommand { ItineraryId = 1 });

            optimizeRouteService.Verify(x => x.OptimizeRoute(It.IsAny <OptimizeRouteCriteria>()), Times.Once);
            criteria.StartAddress.ShouldBe(EncodedFullAddress);
            criteria.EndAddress.ShouldBe(EncodedFullAddress);
            criteria.Waypoints.Count.ShouldBe(2);
        }