public void NewPassAfterOneHourIsAddedToTheTotal() { var day = new CalendarDay { Year = 2013, Month = Month.January, Day = 2 }; var calculator = new TollCalculator.TollCalculator(day, VehicleType.Car); calculator.PassToll(new TimeOfDay { Hour = 6, Minute = 15 }); // 8 SEK calculator.PassToll(new TimeOfDay { Hour = 15, Minute = 5 }); // 13 SEK Assert.AreEqual(21, calculator.TotalFee); }
public void MultiplePassesInOneHourCostsTheHighestFeeOnly() { var day = new CalendarDay { Year = 2013, Month = Month.January, Day = 2 }; var calculator = new TollCalculator.TollCalculator(day, VehicleType.Car); calculator.PassToll(new TimeOfDay { Hour = 6, Minute = 15 }); // 8 SEK calculator.PassToll(new TimeOfDay { Hour = 7, Minute = 5 }); // 18 SEK Assert.AreEqual(18, calculator.TotalFee); }
[TestCase(Month.December, 31)] // New Year's Eve public void TollFreeDates2017(Month month, int day) { var calendarDay = new CalendarDay(2017, month, day); var calculator = new TollCalculator.TollCalculator(calendarDay, VehicleType.Car); calculator.PassToll(new TimeOfDay { Hour = 7, Minute = 5 }); Assert.AreEqual(0, calculator.TotalFee); }
public void SinglePassFee(int hour, int minute, int expectedFee) { var day = new CalendarDay { Year = 2013, Month = Month.January, Day = 2 }; var calculator = new TollCalculator.TollCalculator(day, VehicleType.Car); calculator.PassToll(new TimeOfDay(hour, minute)); Assert.AreEqual(expectedFee, calculator.TotalFee); }
public void NeverExceeds60InTotal() { var day = new CalendarDay { Year = 2013, Month = Month.January, Day = 2 }; var calculator = new TollCalculator.TollCalculator(day, VehicleType.Car); calculator.PassToll(new TimeOfDay { Hour = 6, Minute = 0 }); // 8 SEK calculator.PassToll(new TimeOfDay { Hour = 7, Minute = 1 }); // 18 SEK calculator.PassToll(new TimeOfDay { Hour = 8, Minute = 2 }); // 13 SEK calculator.PassToll(new TimeOfDay { Hour = 9, Minute = 3 }); // 8 SEK calculator.PassToll(new TimeOfDay { Hour = 10, Minute = 4 }); // 8 SEK calculator.PassToll(new TimeOfDay { Hour = 11, Minute = 5 }); // 8 SEK // 8+18+13+8+8+8 == 63 Assert.AreEqual(60, calculator.TotalFee); }
public void TollFreeForMotorcycles() { var day = new CalendarDay { Year = 2013, Month = Month.January, Day = 2 }; var calculator = new TollCalculator.TollCalculator(day, VehicleType.Motorbike); calculator.PassToll(new TimeOfDay { Hour = 7, Minute = 5 }); Assert.AreEqual(0, calculator.TotalFee); }