public void GetDailyTollFee_PayingVehicle_PaysToll() { var tollFeeCalculator = new TollFeeCalculator(new SwedenHolidayLookupFor2017()); tollFeeCalculator.GetDailyTollFee(new Car(), new [] { new DateTime(2017, (int)Month.November, 1, 14, 05, 10), // 0 kr new DateTime(2017, (int)Month.November, 1, 16, 05, 10), // 18 kr new DateTime(2017, (int)Month.November, 1, 18, 05, 10) // 8 kr }).ShouldBe(26); tollFeeCalculator.GetDailyTollFee(new Car(), new[] { new DateTime(2017, (int)Month.November, 1, 06, 40, 40), // 13 kr new DateTime(2017, (int)Month.November, 1, 16, 05, 10), // 18 kr new DateTime(2017, (int)Month.November, 1, 18, 05, 10) // 8 kr }).ShouldBe(39); tollFeeCalculator.GetDailyTollFee(new Car(), new[] { new DateTime(2017, (int)Month.November, 1, 06, 40, 40), // 13 kr new DateTime(2017, (int)Month.November, 1, 16, 05, 10), // 18 kr new DateTime(2017, (int)Month.November, 1, 18, 05, 10), // 8 kr new DateTime(2017, (int)Month.November, 1, 18, 28, 10), // 8 kr new DateTime(2017, (int)Month.November, 1, 18, 04, 10), // 8 kr new DateTime(2017, (int)Month.November, 1, 06, 55, 40), // 13 kr new DateTime(2017, (int)Month.November, 1, 06, 50, 40) // 13 kr }).ShouldBe(39); // public holiday tollFeeCalculator.GetDailyTollFee(new Car(), new[] { new DateTime(2017, (int)Month.December, 31, 06, 40, 40), // 13 kr new DateTime(2017, (int)Month.December, 31, 16, 05, 10), // 18 kr new DateTime(2017, (int)Month.December, 31, 18, 05, 10) // 8 kr }).ShouldBe(0); // weekend tollFeeCalculator.GetDailyTollFee(new Car(), new[] { new DateTime(2017, (int)Month.December, 2, 06, 40, 40), // 13 kr new DateTime(2017, (int)Month.December, 2, 16, 05, 10), // 18 kr new DateTime(2017, (int)Month.December, 2, 18, 05, 10) // 8 kr }).ShouldBe(0); // max daily fee is 60 kr tollFeeCalculator.GetDailyTollFee(new Car(), new[] { new DateTime(2017, (int)Month.December, 1, 06, 40, 40), // 13 kr new DateTime(2017, (int)Month.December, 1, 07, 41, 40), // 18 kr new DateTime(2017, (int)Month.December, 1, 08, 45, 40), // 8 kr new DateTime(2017, (int)Month.December, 1, 16, 05, 10), // 18 kr new DateTime(2017, (int)Month.December, 1, 18, 05, 10) // 8 kr }).ShouldBe(60); }
public void GetDailyTollFee_TollFreeVehicle_NoToll() { var tollFeeCalculator = new TollFeeCalculator(Substitute.For <IHolidayLookup>()); tollFeeCalculator.GetDailyTollFee(new Diplomat(), new [] { new DateTime(2017, 11, 27, 08, 25, 12) }).ShouldBe(0); }