Ejemplo n.º 1
0
        public void RatesCalculatorNightRateTestPositive1()
        {
            // Act
            //weekday
            //ud.Entry is 6PM
            //6PM ud.Entry and 11PM exit
            //Night rate

            _ud.Entry = DateTime.Parse("2017-03-01 18:00:00");
            _ud.Exit  = DateTime.Parse("2017-03-01 23:00:00");
            Rate result = _calculator.CalculateFlatRate(_ud);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Night Rate", result.RateName);
            Assert.AreEqual("Flat Rate", result.RateType);
            Assert.AreEqual(6.50M, result.RatePrice);
        }
        public void RatesCalculatorWeekendTestPositive1()
        {
            // Act
            //weekend
            //ud.Entry is midnight sat morn
            //exit 11.59 sun night
            //Weekend rate

            _ud.Entry = DateTime.Parse("2017-03-04 00:00:00");
            _ud.Exit  = DateTime.Parse("2017-03-05 23:59:00");

            Rate result = _calculator.CalculateFlatRate(_ud);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Weekend Rate", result.RateName);
            Assert.AreEqual("Flat Rate", result.RateType);
            Assert.AreEqual(10M, result.RatePrice);
        }
        public void RatesCalculatorHourlyTest1()
        {
            //weekday - no weekend
            //ud.Entry is 9.30 - outside early bird & night
            //ud.Exit 10.00 - < 1 hour
            //Hourly rate $5
            _ud.Entry = DateTime.Parse("2017-03-01 09:30:00");
            _ud.Exit  = DateTime.Parse("2017-03-01 10:00:00");

            Rate flat = _calculator.CalculateFlatRate(_ud);

            Assert.IsNull(flat);

            Rate result = _calculator.CalculateHourlyRate(_ud);

            Assert.AreEqual("Standard Rate", result.RateName);
            Assert.AreEqual("Hourly Rate", result.RateType);
            Assert.AreEqual(5M, result.RatePrice);
        }
        public void RatesCalculatorEarlyBirdTestPositive1()
        {
            // Act
            //this date is a wednesday so weekend rate not applicable
            //ud.Entry is 6am
            //exit 3.30PM
            //Early bird

            ud.Entry = DateTime.Parse("2017-03-01 06:00:00");
            ud.Exit  = DateTime.Parse("2017-03-01 15:30:00");
            Rate result = _calculator.CalculateFlatRate(ud);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Early Bird", result.RateName);
            Assert.AreEqual("Flat Rate", result.RateType);
            Assert.AreEqual(13M, result.RatePrice);
        }