public void ShouldApplyDiscount_For_B() { var checkout = new Checkout(); checkout.AddDiscount(new Discount { Name = "B", Quantity = 2, Value = 15 }); checkout.Scan(new Item { Price = 30, Name = "B" }); checkout.Scan(new Item { Price = 30, Name = "B" }); var result = checkout.Total(); Assert.AreEqual(45, result); }
public void ShouldApplyDiscount_For_A() { var checkout = new Checkout(); checkout.AddDiscount(new Discount { Name = "A", Quantity = 3, Value = 20 }); checkout.Scan(new Item { Price = 50, Name = "A" }); checkout.Scan(new Item { Price = 50, Name = "A" }); checkout.Scan(new Item { Price = 50, Name = "A" }); var result = checkout.Total(); Assert.AreEqual(130, result); }