Ejemplo n.º 1
0
        public void ShouldGiveNullWhenTryingToCalculatePriceFromBadState(string category, DateTime?rented, DateTime?returned, decimal?milageAtRent, decimal?milageAtReturn)
        {
            var carRental = new CarRental()
            {
                CarCategory           = category,
                Rented                = rented,
                Returned              = returned,
                CarMilageAtRentInKm   = milageAtRent,
                CarMilageAtReturnInKm = milageAtReturn
            };

            Assert.AreEqual(null, carRental.CalculateRentalCost());
        }
Ejemplo n.º 2
0
        public void ShouldGiveExpectedPrice(string category, int days, decimal milage, decimal expectedPrice)
        {
            var carRental = new CarRental()
            {
                CarCategory           = category,
                Rented                = DateTime.UtcNow,
                Returned              = DateTime.UtcNow.AddDays(days),
                CarMilageAtRentInKm   = 1,
                CarMilageAtReturnInKm = 1 + milage
            };

            Assert.AreEqual(expectedPrice, carRental.CalculateRentalCost(), "Default prices no longer valid. Have they changed?");
        }