Example #1
0
        public void RoutePunctualityHourAvgBeforeAvgAfterTime_WhenRouteHaveNotTraces_ReturnsTuple00()
        {
            var route = new Route
            {
                BusStops = new List <BusStop>
                {
                    new BusStop
                    {
                        BusStopTraces = new List <BusStopTrace>()
                    },
                    new BusStop
                    {
                        BusStopTraces = new List <BusStopTrace>()
                    }
                }
            };

            var result = PunctualityConverter.RoutePunctualityHourAvgBeforeAvgAfterTime(route);

            Assert.AreEqual((0, 0), result);
        }
Example #2
0
        private static void SetPunctualityForRoute(Route route, ref RoutesRouteDto routeDto)
        {
            for (int i = 0; i < route.BusStops.Count; i++)
            {
                routeDto.BusStops.ElementAt(i).PunctualityPercentage
                    = PunctualityConverter.BusStopPunctualityPercentage(route.BusStops.ElementAt(i));
                routeDto.BusStops.ElementAt(i).PunctualityMode
                    = PunctualityConverter.BusStopPunctualityHourMode(route.BusStops.ElementAt(i)).ToString(@"hh\:mm");

                var avgTuple = PunctualityConverter
                               .BusStopPunctualityHourAvgBeforeAvgAfterTime(route.BusStops.ElementAt(i));
                routeDto.BusStops.ElementAt(i).PunctualityAvgBeforeTime = avgTuple.avgTimeBefore.ToString();
                routeDto.BusStops.ElementAt(i).PunctualityAvgAfterTime  = avgTuple.avgTimeAfter.ToString();
            }

            var avgPunctuality =
                PunctualityConverter.RoutePunctualityHourAvgBeforeAvgAfterTime(route);

            routeDto.PunctualityAvgBeforeTime = avgPunctuality.avgTimeBefore.ToString();
            routeDto.PunctualityAvgAfterTime  = avgPunctuality.avgTimeAfter.ToString();
        }
Example #3
0
        public void RoutePunctualityHourAvgBeforeAvgAfterTime_WhenRouteHaveTraces_ReturnsTuple()
        {
            var result = PunctualityConverter.RoutePunctualityHourAvgBeforeAvgAfterTime(_routes[0]);

            Assert.AreEqual((4, 8), result);
        }