Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void NoFeeIfNoPasses()
        {
            var day = new CalendarDay {
                Year = 2013, Month = Month.January, Day = 2
            };
            var calculator = new TollCalculator.TollCalculator(day, VehicleType.Car);

            Assert.AreEqual(0, calculator.TotalFee);
        }
Exemplo n.º 3
0
        [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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }