示例#1
0
        public void NightRate_EntryIsOnSaturday()
        {
            parkingFeeCalculator = new NightRateCalulatorService();
            DateTime entryTime = new DateTime(2020, 7, 11, 18, 5, 0);
            DateTime exitTime  = new DateTime(2020, 7, 11, 23, 30, 0);

            var ruleApply = parkingFeeCalculator.IsRuleApplicable(entryTime, exitTime);

            Assert.IsFalse(ruleApply);
        }
示例#2
0
        public void NightRateTest_ExitTimeNotMeetingConditon()
        {
            parkingFeeCalculator = new NightRateCalulatorService();
            DateTime entryTime = new DateTime(2020, 7, 10, 16, 5, 0);
            DateTime exitTime  = new DateTime(2020, 7, 10, 23, 47, 0);

            var ruleApply = parkingFeeCalculator.IsRuleApplicable(entryTime, exitTime);

            Assert.IsFalse(ruleApply);
        }
示例#3
0
        public void EarlyBirdTest_ExitTimeNotMeetingCondition()
        {
            parkingFeeCalculator = new EarlyBirdRateCalculatorService();
            DateTime entryTime = new DateTime(2020, 7, 12, 6, 0, 0);
            DateTime exitTime  = new DateTime(2020, 7, 12, 23, 55, 0);

            var ruleApply = parkingFeeCalculator.IsRuleApplicable(entryTime, exitTime);

            Assert.IsFalse(ruleApply);
        }
示例#4
0
        public void NightRateTest()
        {
            parkingFeeCalculator = new NightRateCalulatorService();
            DateTime entryTime = new DateTime(2020, 7, 10, 18, 5, 0);
            DateTime exitTime  = new DateTime(2020, 7, 10, 23, 30, 0);

            var fee       = parkingFeeCalculator.Calculate(entryTime, exitTime);
            var ruleApply = parkingFeeCalculator.IsRuleApplicable(entryTime, exitTime);

            Assert.AreEqual(6.5, fee);
            Assert.IsTrue(ruleApply);
        }
示例#5
0
        public void WeekendRateTest_EntrySatExitSun()
        {
            parkingFeeCalculator = new WeekendRateCalculatorService();
            DateTime entryTime = new DateTime(2020, 7, 11, 0, 0, 0);
            DateTime exitTime  = new DateTime(2020, 7, 12, 23, 30, 0);

            var fee       = parkingFeeCalculator.Calculate(entryTime, exitTime);
            var ruleApply = parkingFeeCalculator.IsRuleApplicable(entryTime, exitTime);

            Assert.AreEqual(10, fee);
            Assert.IsTrue(ruleApply);
        }
示例#6
0
        public void EarlyBirdTest()
        {
            parkingFeeCalculator = new EarlyBirdRateCalculatorService();
            DateTime entryTime = new DateTime(2020, 7, 12, 7, 0, 0);
            DateTime exitTime  = new DateTime(2020, 7, 12, 23, 30, 0);

            var ruleApply = parkingFeeCalculator.IsRuleApplicable(entryTime, exitTime);
            var fee       = parkingFeeCalculator.Calculate(entryTime, exitTime);

            Assert.AreEqual(13, fee);
            Assert.IsTrue(ruleApply);
        }