public void WhenCheeseIsNotExpired_TotalIsFullPriceOfCheese()
        {
            var expiryDate = DateTime.Today.AddDays(1);
            var freshCheese = new Cheese(4.50m, new ExpiredDiscount(0.5m, expiryDate, () => DateTime.Now));

            var cart = new ShoppingCart(new ICartItem[] { freshCheese });

            Assert.Equal(4.50m, cart.SaleTotal);
        }
        public void CartWithCheeseAndScrewdriver_TotalIsSumOfBothItemsSalePrices()
        {
            var cheese = new Cheese(4.99m);
            var driver = new Screwdriver(25.0m);

            var cart = new ShoppingCart(new ICartItem[] { driver, cheese });

            Assert.Equal(cheese.SalePrice + driver.SalePrice, cart.SaleTotal);
        }
        public void TotalDiscountsForBundle()
        {
            var cheese = new Cheese(4.5m);
            var screwdriver = new Screwdriver(25.0m);
            var bundle = new Bundle(cheese, screwdriver, new PercentageDiscount(0.1m));

            var cart = new ShoppingCart(new ICartItem[] { bundle });

            Assert.Equal((cheese.SalePrice + screwdriver.SalePrice) * 0.1m, cart.SaleTotal);
        }
        public void WhenCheeseIsExpired_TotalIncludesDiscount()
        {
            const decimal salePrice = 4.50m;
            const decimal discount = 0.5m;
            var expiryDate = DateTime.Today.AddDays(-1);
            var expiredCheese = new Cheese(salePrice, new ExpiredDiscount(discount, expiryDate, () => DateTime.Now));

            var cart = new ShoppingCart(new ICartItem[] { expiredCheese });

            Assert.Equal(salePrice * discount, cart.SaleTotal);
        }