public void TestTotalCostWithNoDiscount() { List <ShoppingCart> cart = new List <ShoppingCart>(); cart.Add(new ShoppingCart() { Product = new ShoppingProduct() { Name = "A", UnitPrice = 50.0 }, Quantity = 1 }); cart.Add(new ShoppingCart() { Product = new ShoppingProduct() { Name = "B", UnitPrice = 30.0 }, Quantity = 1 }); cart.Add(new ShoppingCart() { Product = new ShoppingProduct() { Name = "C", UnitPrice = 20.0 }, Quantity = 1 }); cart.Add(new ShoppingCart() { Product = new ShoppingProduct() { Name = "D", UnitPrice = 15.0 }, Quantity = 1 }); Assert.Equal(115, _sut.CalculateTotalCost(cart)); }
public void CalculateTotalCost_ReturnsADiscountedCostOfFifty_WhenItemAIsAddedSixTimes() { //arrange const int expected = 50; for (int i = 0; i < 6; i++) { Checkout.AddItem("A"); } //act var actual = Checkout.CalculateTotalCost(); //assert Assert.Equal(expected, actual); }