public void TestBusStopNameNumber()
        {
            BusScheduleService svc       = new BusScheduleService();
            BusStop            modelStop = new BusStop {
                StopName = "Stop1", StopNumber = 1
            };
            List <BusStop> busStops = svc.InitializeBusStops();

            Assert.Equal(busStops.ElementAt(0).StopName, modelStop.StopName);
            Assert.Equal(busStops.ElementAt(0).StopNumber, modelStop.StopNumber);

            modelStop = new BusStop {
                StopName = "Stop2", StopNumber = 2
            };
            Assert.Equal(busStops.ElementAt(1).StopName, modelStop.StopName);
            Assert.Equal(busStops.ElementAt(1).StopNumber, modelStop.StopNumber);

            modelStop = new BusStop {
                StopName = "Stop5", StopNumber = 5
            };
            Assert.Equal(busStops.ElementAt(4).StopName, modelStop.StopName);
            Assert.Equal(busStops.ElementAt(4).StopNumber, modelStop.StopNumber);

            modelStop = new BusStop {
                StopName = "Stop10", StopNumber = 10
            };
            Assert.Equal(busStops.ElementAt(9).StopName, modelStop.StopName);
            Assert.Equal(busStops.ElementAt(9).StopNumber, modelStop.StopNumber);
        }
        public void TestBusSchduleByStop()
        {
            string        time        = "3:01";
            string        stopName    = "Stop1";
            int           stopNUmber  = 1;
            List <string> stop1Route1 = new List <string> {
                "Arriving in: 14 minutes", "29 minutes"
            };
            List <string> stop1Route2 = new List <string> {
                "Arriving in: 1 minutes", "16 minutes"
            };
            List <string> stop1Route3 = new List <string> {
                "Arriving in: 3 minutes", "18 minutes"
            };

            BusScheduleService svc        = new BusScheduleService();
            BusStop            fullRoutes = svc.GetNextTwoBusArrivalDataByStop(1, time);

            Assert.Equal(fullRoutes.StopName, stopName);
            Assert.Equal(fullRoutes.StopNumber, stopNUmber);

            var s1r1 = fullRoutes.StopSchedule.Values.ElementAt(0);

            Assert.Equal(string.Join(",", s1r1), string.Join(",", stop1Route1));

            var s1r2 = fullRoutes.StopSchedule.Values.ElementAt(1);

            Assert.Equal(string.Join(",", s1r2), string.Join(",", stop1Route2));

            var s1r3 = fullRoutes.StopSchedule.Values.ElementAt(2);

            Assert.Equal(string.Join(",", s1r3), string.Join(",", stop1Route3));
        }
        public void TestBusRoute()
        {
            BusScheduleService svc        = new BusScheduleService();
            BusRoute           modelRoute = new BusRoute {
                RouteName = "Route1", RouteNumber = 1
            };
            List <BusRoute> routes = svc.InitializeRoutes();

            Assert.Equal(routes.ElementAt(0).RouteName, modelRoute.RouteName);
            Assert.Equal(routes.ElementAt(0).RouteNumber, modelRoute.RouteNumber);

            modelRoute = new BusRoute {
                RouteName = "Route2", RouteNumber = 2
            };
            Assert.Equal(routes.ElementAt(1).RouteName, modelRoute.RouteName);
            Assert.Equal(routes.ElementAt(1).RouteNumber, modelRoute.RouteNumber);

            modelRoute = new BusRoute {
                RouteName = "Route3", RouteNumber = 3
            };
            Assert.Equal(routes.ElementAt(2).RouteName, modelRoute.RouteName);
            Assert.Equal(routes.ElementAt(2).RouteNumber, modelRoute.RouteNumber);
        }
        public void TestBusSchduleByTime()
        {
            string        time        = "3:01";
            List <string> stop1Route1 = new List <string> {
                "Arriving in: 14 minutes", "29 minutes"
            };
            List <string> stop1Route2 = new List <string> {
                "Arriving in: 1 minutes", "16 minutes"
            };
            List <string> stop1Route3 = new List <string> {
                "Arriving in: 3 minutes", "18 minutes"
            };

            List <string> stop2Route1 = new List <string> {
                "Arriving in: 1 minutes", "16 minutes"
            };
            List <string> stop2Route2 = new List <string> {
                "Arriving in: 3 minutes", "18 minutes"
            };
            List <string> stop2Route3 = new List <string> {
                "Arriving in: 5 minutes", "20 minutes"
            };

            List <string> stop3Route1 = new List <string> {
                "Arriving in: 3 minutes", "18 minutes"
            };
            List <string> stop3Route2 = new List <string> {
                "Arriving in: 5 minutes", "20 minutes"
            };
            List <string> stop3Route3 = new List <string> {
                "Arriving in: 7 minutes", "22 minutes"
            };

            BusScheduleService svc        = new BusScheduleService();
            List <BusStop>     fullRoutes = svc.GetNextTwoBusArrivalDataByTime(time);

            var s1r1 = fullRoutes.ElementAt(0).StopSchedule.Values.ElementAt(0);

            Assert.Equal(string.Join(",", s1r1), string.Join(",", stop1Route1));

            var s1r2 = fullRoutes.ElementAt(0).StopSchedule.Values.ElementAt(1);

            Assert.Equal(string.Join(",", s1r2), string.Join(",", stop1Route2));

            var s1r3 = fullRoutes.ElementAt(0).StopSchedule.Values.ElementAt(2);

            Assert.Equal(string.Join(",", s1r3), string.Join(",", stop1Route3));

            var s2r1 = fullRoutes.ElementAt(1).StopSchedule.Values.ElementAt(0);

            Assert.Equal(string.Join(",", s2r1), string.Join(",", stop2Route1));

            var s2r2 = fullRoutes.ElementAt(1).StopSchedule.Values.ElementAt(1);

            Assert.Equal(string.Join(",", s2r2), string.Join(",", stop2Route2));

            var s2r3 = fullRoutes.ElementAt(1).StopSchedule.Values.ElementAt(2);

            Assert.Equal(string.Join(",", s2r3), string.Join(",", stop2Route3));

            var s3r1 = fullRoutes.ElementAt(2).StopSchedule.Values.ElementAt(0);

            Assert.Equal(string.Join(",", s3r1), string.Join(",", stop3Route1));

            var s3r2 = fullRoutes.ElementAt(2).StopSchedule.Values.ElementAt(1);

            Assert.Equal(string.Join(",", s3r2), string.Join(",", stop3Route2));

            var s3r3 = fullRoutes.ElementAt(2).StopSchedule.Values.ElementAt(2);

            Assert.Equal(string.Join(",", s3r3), string.Join(",", stop3Route3));
        }
        public void TestBusSchdule()
        {
            List <string> stop1Route1 = new List <string> {
                "00:00", "00:15", "00:30", "00:45"
            };
            List <string> stop1Route2 = new List <string> {
                "00:02", "00:17", "00:32", "00:47"
            };
            List <string> stop1Route3 = new List <string> {
                "00:04", "00:19", "00:34", "00:49"
            };

            List <string> stop3Route1 = new List <string> {
                "00:04", "00:19", "00:34", "00:49"
            };
            List <string> stop3Route2 = new List <string> {
                "00:06", "00:21", "00:36", "00:51"
            };
            List <string> stop3Route3 = new List <string> {
                "00:08", "00:23", "00:38", "00:53"
            };

            BusScheduleService svc        = new BusScheduleService();
            List <BusStop>     fullRoutes = svc.GetAllStopRouteData();

            var s1r1 = fullRoutes.ElementAt(0).StopSchedule.Values.ElementAt(0);

            Assert.Equal(s1r1.ElementAt(0), stop1Route1.ElementAt(0));
            Assert.Equal(s1r1.ElementAt(1), stop1Route1.ElementAt(1));
            Assert.Equal(s1r1.ElementAt(2), stop1Route1.ElementAt(2));
            Assert.Equal(s1r1.ElementAt(3), stop1Route1.ElementAt(3));

            var s1r2 = fullRoutes.ElementAt(0).StopSchedule.Values.ElementAt(1);

            Assert.Equal(s1r2.ElementAt(0), stop1Route2.ElementAt(0));
            Assert.Equal(s1r2.ElementAt(1), stop1Route2.ElementAt(1));
            Assert.Equal(s1r2.ElementAt(2), stop1Route2.ElementAt(2));
            Assert.Equal(s1r2.ElementAt(3), stop1Route2.ElementAt(3));

            var s1r3 = fullRoutes.ElementAt(0).StopSchedule.Values.ElementAt(2);

            Assert.Equal(s1r3.ElementAt(0), stop1Route3.ElementAt(0));
            Assert.Equal(s1r3.ElementAt(1), stop1Route3.ElementAt(1));
            Assert.Equal(s1r3.ElementAt(2), stop1Route3.ElementAt(2));
            Assert.Equal(s1r3.ElementAt(3), stop1Route3.ElementAt(3));

            var s3r1 = fullRoutes.ElementAt(2).StopSchedule.Values.ElementAt(0);

            Assert.Equal(s3r1.ElementAt(0), stop3Route1.ElementAt(0));
            Assert.Equal(s3r1.ElementAt(1), stop3Route1.ElementAt(1));
            Assert.Equal(s3r1.ElementAt(2), stop3Route1.ElementAt(2));
            Assert.Equal(s3r1.ElementAt(3), stop3Route1.ElementAt(3));

            var s3r2 = fullRoutes.ElementAt(2).StopSchedule.Values.ElementAt(1);

            Assert.Equal(s3r2.ElementAt(0), stop3Route2.ElementAt(0));
            Assert.Equal(s3r2.ElementAt(1), stop3Route2.ElementAt(1));
            Assert.Equal(s3r2.ElementAt(2), stop3Route2.ElementAt(2));
            Assert.Equal(s3r2.ElementAt(3), stop3Route2.ElementAt(3));

            var s3r3 = fullRoutes.ElementAt(2).StopSchedule.Values.ElementAt(2);

            Assert.Equal(s3r3.ElementAt(0), stop3Route3.ElementAt(0));
            Assert.Equal(s3r3.ElementAt(1), stop3Route3.ElementAt(1));
            Assert.Equal(s3r3.ElementAt(2), stop3Route3.ElementAt(2));
            Assert.Equal(s3r3.ElementAt(3), stop3Route3.ElementAt(3));
        }