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 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); }