Example #1
0
        public double CalculatePrice(IBikeRental bikeRental)
        {
            double discountPerc = (double)(100 - this.Discount) / 100;
            double totalPrice   = bikeRental.BikesAmount * bikeRental.UnitPrice * discountPerc;

            return(totalPrice);
        }
Example #2
0
        public void GeFamilyDayRentalForThreeTest()
        {
            IBikeRental familyDayRentalForThree = bikeRentalFactory.GeFamilyDayRentalForThree();

            Assert.AreEqual(3, familyDayRentalForThree.BikesAmount, "Bikes Amount should be 3 for Family Day Rental For Three rentals.");
            Assert.AreEqual(24, familyDayRentalForThree.LengthInHours, "Length in Hours should be 24 for Family Day Rental For Three rentals.");
            Assert.AreEqual(20, familyDayRentalForThree.UnitPrice, "Unit Price should be 20 for Family Day Rental For Three rentals.");
            Assert.AreEqual(42, familyDayRentalForThree.TotalPrice, "Total Price should be 42 for Family Day Rental For Three rentals.");
        }
Example #3
0
        public void GeFamilyWeekRentalForThreeTest()
        {
            IBikeRental familyWeekRentalForThree = bikeRentalFactory.GeFamilyWeekRentalForThree();

            Assert.AreEqual(3, familyWeekRentalForThree.BikesAmount, "Bikes Amount should be 3 for Family Week Rental For Three rentals.");
            Assert.AreEqual(168, familyWeekRentalForThree.LengthInHours, "Length in Hours should be 168 for Family Week Rental For Three rentals.");
            Assert.AreEqual(60, familyWeekRentalForThree.UnitPrice, "Unit Price should be 60 for Family Week Rental For Three rentals.");
            Assert.AreEqual(126, familyWeekRentalForThree.TotalPrice, 0.00000001, "Total Price should be 126 for Family Week Rental For Three rentals.");
        }
Example #4
0
        public void GeFamilyHourRentalForThreeTest()
        {
            IBikeRental familyHourRentalForThree = bikeRentalFactory.GeFamilyHourRentalForThree();

            Assert.AreEqual(3, familyHourRentalForThree.BikesAmount, "Bikes Amount should be 3 for Family Hour Rental For Three rentals.");
            Assert.AreEqual(1, familyHourRentalForThree.LengthInHours, "Length in Hours should be 1 for Family Hour Rental For Three rentals.");
            Assert.AreEqual(5, familyHourRentalForThree.UnitPrice, "Unit Price should be 5 for Family Hour Rental For Three rentals.");
            Assert.AreEqual(10.5, familyHourRentalForThree.TotalPrice, "Total Price should be 10.5 for Family Hour Rental For Three rentals.");
        }
Example #5
0
        public void GeWeekRentalTest()
        {
            IBikeRental weekRental = bikeRentalFactory.GetWeekRental();

            Assert.AreEqual(1, weekRental.BikesAmount, "Bikes Amount should be 1 for Week rentals.");
            Assert.AreEqual(168, weekRental.LengthInHours, "Length in Hours should be 168 for Week rentals.");
            Assert.AreEqual(60, weekRental.UnitPrice, "Unit Price should be 60 for Week rentals.");
            Assert.AreEqual(60, weekRental.TotalPrice, "Total Price should be 60 for Week rentals.");
        }
Example #6
0
        public void GeDayRentalTest()
        {
            IBikeRental dayRental = bikeRentalFactory.GetDayRental();

            Assert.AreEqual(1, dayRental.BikesAmount, "Bikes Amount should be 1 for Day rentals.");
            Assert.AreEqual(24, dayRental.LengthInHours, "Length in Hours should be 24 for Day rentals.");
            Assert.AreEqual(20, dayRental.UnitPrice, "Unit Price should be 20 for Day rentals.");
            Assert.AreEqual(20, dayRental.TotalPrice, "Total Price should be 20 for Day rentals.");
        }
Example #7
0
        public void GetHourRentalTest()
        {
            IBikeRental hourRental = bikeRentalFactory.GetHourRental();

            Assert.AreEqual(1, hourRental.BikesAmount, "Bikes Amount should be 1 for Hour rentals.");
            Assert.AreEqual(1, hourRental.LengthInHours, "Length in Hours should be 1 for Hour rentals.");
            Assert.AreEqual(5, hourRental.UnitPrice, "Unit Price should be 5 for Hour rentals.");
            Assert.AreEqual(5, hourRental.TotalPrice, "Total Price should be 5 for Hour rentals.");
        }
 public double CalculatePrice(IBikeRental bikeRental)
 {
     return(bikeRental.UnitPrice);
 }
Example #9
0
 public void GeFamilyWeekRentalForSixTest()
 {
     IBikeRental familyWeekRentalForSix = bikeRentalFactory.GeFamilyWeekRentalForSix();
 }