예제 #1
0
        public void AddingMoreThanFiveDiscountsToFamilyThrowsException()
        {
            Family family = new SubscriptionFactory().familyFiveDiscounts;

            Assert.IsTrue(family.TotalDiscount() == 5);
            family.AddDiscountType(new SubscriptionFactory().hourly);
        }
예제 #2
0
        public void FamilyWithHourlyHourlyHourlyCharges9Dollars()
        {
            // 3 hourly subscription for 2 hours each: 30 dollars - 30% discount = 9 dollars
            SubscriptionFactory sbf = new SubscriptionFactory();
            Family family           = new Family(sbf.hourly, sbf.hourly, sbf.hourly);

            Assert.IsTrue(family.CalculateRentalCost(DateTimeFactory.dt1, DateTimeFactory.dt2) == 9);
        }
예제 #3
0
        public void AddDiscountToFamilyIncrementsInOne()
        {
            Family family = new SubscriptionFactory().familyThreeDiscounts;

            Assert.IsTrue(family.TotalDiscount() == 3);
            family.AddDiscountType(new SubscriptionFactory().weekly);
            Assert.IsTrue(family.TotalDiscount() == 4);
        }
예제 #4
0
        public RentalFactory()
        {
            SubscriptionFactory sbf = new SubscriptionFactory();

            rentalHourlyTwoHours = new Rental(sbf.hourly, DateTimeFactory.dt1, DateTimeFactory.dt2);

            rentalDailyFourDays = new Rental(sbf.daily, DateTimeFactory.dt1, DateTimeFactory.dt3);

            rentalWeeklyTwoWeeks = new Rental(sbf.weekly, DateTimeFactory.dt1, DateTimeFactory.dt4);
        }
예제 #5
0
        public void FamilyWithHourlyDailyWeeklyCharges()
        {
            // 1 weekly subscription for 1 week: 60
            // 1 daily subscription for 1 week: 7*20 = 140
            // 1 hourly subscription for 1 week: 5*24*7 = 840
            // 30% Discount = 728 total
            SubscriptionFactory sbf = new SubscriptionFactory();
            Family family           = new Family(sbf.hourly, sbf.weekly, sbf.daily);

            Assert.IsTrue(family.CalculateRentalCost(DateTimeFactory.dt1, DateTimeFactory.dt5) == 728);
        }