public double CalculatePrice(IBikeRental bikeRental) { double discountPerc = (double)(100 - this.Discount) / 100; double totalPrice = bikeRental.BikesAmount * bikeRental.UnitPrice * discountPerc; return(totalPrice); }
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."); }
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."); }
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."); }
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."); }
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."); }
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); }
public void GeFamilyWeekRentalForSixTest() { IBikeRental familyWeekRentalForSix = bikeRentalFactory.GeFamilyWeekRentalForSix(); }