public void CartWithOneScrewdriver_TotalIsSalePriceOfScrewdriver()
        {
            const decimal salePrice = 25.0m;
            var screwdriver = new Screwdriver(salePrice);
            var cart = new ShoppingCart(new ICartItem[] { screwdriver });

            Assert.Equal(salePrice, cart.SaleTotal);
        }
        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 CartWithMultipleScrewdrivers_TotalIsSumOfScrewdriverSalePrices()
        {
            var cheapDriver = new Screwdriver(5.0m);
            var expensiveDriver = new Screwdriver(50.0m);

            var cart = new ShoppingCart(new ICartItem[] { cheapDriver, expensiveDriver });

            Assert.Equal(cheapDriver.SalePrice + expensiveDriver.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);
        }
 public void HasZeroTotal()
 {
     var cart = new ShoppingCart();
     Assert.Equal(0.0m, cart.SaleTotal);
 }