public void SetUp() { this.Client = new Client(); this.BikeSpecifications = new BikeSpecifications(TestsConstants.BIKE_BRAND, TestsConstants.BIKE_MODEL, TestsConstants.BIKE_COLOR); this.Bike = new Bike(TestsConstants.BIKE_IDENTIFICATION_CODE, this.BikeSpecifications); PromotionRules familyRentalRules = new PromotionRules(TestsConstants.FAMILY_RENTAL_TERMS_AND_CONDITIONS, new DateTime(TestsConstants.FAMILY_RENTAL_EFFECTIVE_DATE_YEAR, TestsConstants.FAMILY_RENTAL_EFFECTIVE_DATE_MONTH, TestsConstants.FAMILY_RENTAL_EFFECTIVE_DATE_DAY, 0, 0, 0), new DateTime(TestsConstants.FAMILY_RENTAL_EXPIRATON_DATE_YEAR, TestsConstants.FAMILY_RENTAL_EXPIRATON_DATE_MONTH, TestsConstants.FAMILY_RENTAL_EXPIRATON_DATE_DAY, 0, 0, 0)); FamilyRentalInformation familyRentalInformation = new FamilyRentalInformation( TestsConstants.FAMILY_RENTAL_DISCOUNT_PERCENT, TestsConstants.FAMILY_RENTAL_MINIMUM_RENTALS, TestsConstants.FAMILY_RENTAL_MAXIMUM_RENTALS, familyRentalRules); RentalByHour rentalByHour = new RentalByHour(new Money(TestsConstants.RENTAL_BY_HOUR_AMOUNT, TestsConstants.RENTAL_BY_HOUR_TYPE_OF_CURRENCY)); RentalByDay rentalByDay = new RentalByDay(new Money(TestsConstants.RENTAL_BY_DAY_AMOUNT, TestsConstants.RENTAL_BY_DAY_TYPE_OF_CURRENCY)); RentalByWeek rentalByWeek = new RentalByWeek(new Money(TestsConstants.RENTAL_BY_WEEK_AMOUNT, TestsConstants.RENTAL_BY_WEEK_TYPE_OF_CURRENCY)); this.RentalOperator = new RentalOperator(familyRentalInformation, rentalByHour, rentalByDay, rentalByWeek); }
public void CanCalculateRentalByDayTotalPrice() { var rental = new RentalByDay(10); Assert.AreEqual(10, rental.Units); Assert.AreEqual(20, rental.UnitPrice); Assert.AreEqual(200, rental.TotalPrice); }
public void SetUp() { this.Cashier = new Cashier(); this.MockClient = new Mock <IClient>(); this.MockRentalOperator = new Mock <IRentalOperator>(); RentalBeginning rentalBeginning = new RentalBeginning(this.MockRentalOperator.Object); BikeSpecifications bikeSpecifications = new BikeSpecifications(TestsConstants.BIKE_BRAND, TestsConstants.BIKE_MODEL, TestsConstants.BIKE_COLOR); Bike bike = new Bike(TestsConstants.BIKE_IDENTIFICATION_CODE, bikeSpecifications); RentalModality rentalModality = new RentalByDay(new Money(TestsConstants.RENTAL_BY_DAY_AMOUNT, TestsConstants.RENTAL_BY_DAY_TYPE_OF_CURRENCY)); this.Rental = new Rental(this.MockClient.Object, rentalBeginning, bike, rentalModality); }
public void UpdateProperties() { RentalByHour rentalByHour = new RentalByHour(new Money(TestsConstants.RENTAL_BY_HOUR_AMOUNT * 2, TestsConstants.RENTAL_BY_HOUR_TYPE_OF_CURRENCY)); RentalByDay rentalByDay = new RentalByDay(new Money(TestsConstants.RENTAL_BY_DAY_AMOUNT * 2, TestsConstants.RENTAL_BY_DAY_TYPE_OF_CURRENCY)); RentalByWeek rentalByWeek = new RentalByWeek(new Money(TestsConstants.RENTAL_BY_WEEK_AMOUNT * 2, TestsConstants.RENTAL_BY_WEEK_TYPE_OF_CURRENCY)); this.RentalOperator.UpdateCurrentRentalByHourModality(rentalByHour); this.RentalOperator.UpdateCurrentRentalByDayModality(rentalByDay); this.RentalOperator.UpdateCurrentRentalByWeekModality(rentalByWeek); Assert.AreEqual(rentalByHour, this.RentalOperator.CurrentRentalByHourModality); Assert.AreEqual(rentalByDay, this.RentalOperator.CurrentRentalByDayModality); Assert.AreEqual(rentalByWeek, this.RentalOperator.CurrentRentalByWeekModality); FamilyRentalInformation familyRentalInformation = new FamilyRentalInformation( TestsConstants.FAMILY_RENTAL_DISCOUNT_PERCENT, 6, 10, this.FamilyRentalRules); this.RentalOperator.UpdateCurrentFamilyRentalInformation(familyRentalInformation); Assert.AreEqual(familyRentalInformation, this.RentalOperator.CurrentFamilyRentalInformation); }
public void SetUp() { this.CostPerUnitOfTime = new Money(TestsConstants.RENTAL_BY_DAY_AMOUNT, TestsConstants.RENTAL_BY_DAY_TYPE_OF_CURRENCY); this.RentalByDay = new RentalByDay(this.CostPerUnitOfTime); }
public void DayCalculateCostPrice20Days2() { IRental rental = new RentalByDay(20m, 2); Assert.AreEqual(40m, rental.CalculateCost()); }