Example #1
0
        public IRouteTotalValues GetTotalValuesOfRoute(IEnumerable <IAddress> addresses, int routeTypes)
        {
            var                     modelFactory = new ModelFactory(_addressFinderService);
            RouteOptions            routeOptions = modelFactory.Create(routeTypes);
            IList <AddressLocation> locations    = modelFactory.Create(addresses);
            IList <RouteStop>       routes       = modelFactory.Create(locations);
            RouteTotals             routeTotal   = _routeService.GetRouteTotalsResponse(routes, routeOptions);

            return(modelFactory.Create(routeTotal));
        }
 public void SetUp()
 {
     _routeTotals = new RouteTotals()
     {
         totalTime = "abcd",
         totalDistance = 200,
         totalfuelCost = 300,
         totalCost = 400
     };
 }
 public void SetUp()
 {
     _routeTotals = new RouteTotals()
     {
         totalTime     = "abcd",
         totalDistance = 200,
         totalfuelCost = 300,
         totalCost     = 400
     };
 }
        public string RouteTotalsToJson(RouteTotals totals)
        {
            var simplifiedTotals = new
            {
                totalTime = totals.totalTime,
                totalDistance = totals.totalDistance,
                totalFuel = totals.totalFuelUsed,
                totalCostWithToolFee = totals.totalCost
            };

            return new Serializer().ObjectToJson(simplifiedTotals);
        }
        public void GetRouteTotalsTest()
        {
            IList <RouteStop> routes = new List <RouteStop>
            {
                _modelFactory.Create("Avenida Paulista, 1000", -46.6520066, -23.5650127),
                _modelFactory.Create("Av Pres Juscelino Kubitschek, 1000", -46.679055, -23.589735),
                _modelFactory.Create("Av Nove de Julho, 1500", -46.6513602, -23.5564401)
            };

            RouteOptions routeOptions = _modelFactory.Create(routeTypes: 23);

            RouteTotals routeTotal = _routeService.GetRouteTotalsResponse(routes, routeOptions);

            routeTotal.Should().Not.Be.Null();
            routeTotal.totalCost.Should().Not.Be(0);
            routeTotal.totalDistance.Should().Not.Be(0);
            routeTotal.totalfuelCost.Should().Not.Be(0);
            routeTotal.totalTime.Should().Not.Be.Empty();
        }
Example #6
0
 public IRouteTotalValues Create(RouteTotals routeTotals)
 {
     return(new RouteTotalValues(routeTotals.totalDistance, routeTotals.totalTime, routeTotals.totalfuelCost, routeTotals.totalCost));
 }
Example #7
0
 public IRouteTotalValues Create(RouteTotals routeTotals)
 {
     return new RouteTotalValues(routeTotals.totalDistance, routeTotals.totalTime, routeTotals.totalfuelCost, routeTotals.totalCost);
 }