protected void UpdateArrivalMinutes()
        {
            if (FirstTrip == null)
            {
                return;
            }

            DateTime          processingTime = FirstRoute.GetRequestProcessingTime();
            TripTimeConverter converter      = new TripTimeConverter(FirstTrip);
            int arrivalMinutes = converter.GetArrivalTimeMinutes(processingTime);

            ArrivalMinutes = arrivalMinutes;
        }
Example #2
0
        public void GetAdjustedArrivalTimeMinutes_Test()
        {
            DateTime timeOfRequest = new DateTime(2020, 1, 1, 0, 0, 0);
            Trip     trip          = new Trip
            {
                AdjustmentAge        = 1,
                AdjustedScheduleTime = 10,
            };

            TripTimeConverter converter = new TripTimeConverter(trip);
            int arrivalTime             = converter.GetAdjustedArrivalTimeMinutes(timeOfRequest);

            int expected = 10;

            Debug.WriteLine($"expected={expected} | arrivalTime={arrivalTime}");
            Assert.AreEqual(expected, arrivalTime);
        }
Example #3
0
        public void GetScheduledArrivalTimeMinutes_MidnightRollover_Test()
        {
            DateTime today = DateTime.Today;
            DateTime now   = today.AddHours(23);
            Trip     trip  = new Trip
            {
                AdjustmentAge        = -1,
                TripStartTime        = "26:30",
                AdjustedScheduleTime = 10,
            };

            TripTimeConverter converter = new TripTimeConverter(trip, today, now);
            int arrivalTime             = converter.GetScheduledArrivalTimeMinutes();

            int expected = (60 * 3) + 30 + 10;

            Debug.WriteLine($"expected={expected} | arrivalTime={arrivalTime}");
            Assert.AreEqual(expected, arrivalTime);
        }
Example #4
0
        public void GetScheduledArrivalTime_Midnight_Test()
        {
            DateTime today = DateTime.Today;
            DateTime now   = today.AddHours(1);
            Trip     trip  = new Trip
            {
                AdjustmentAge        = -1,
                TripStartTime        = "26:30",
                AdjustedScheduleTime = 10,
            };

            TripTimeConverter converter   = new TripTimeConverter(trip, today, now);
            DateTime          arrivalTime = converter.GetScheduledArrivalTime();

            DateTime expected = converter.Today.AddHours(26).AddMinutes(30).AddMinutes(10);

            Debug.WriteLine($"expected={expected} | arrivalTime={arrivalTime}");
            Assert.AreEqual(expected, arrivalTime);
        }