public void TestSpecialOffersAreApplied_OfferNotFullyCovered() { // Arrange var calculator = new CheckoutCalculator(); var items = new CheckOutItemCollection(); items.Add(new CheckoutItem("B", 30)); items.Add(new CheckoutItem("A", 50)); var specialOffers = new List <ISpecialOffer>(); specialOffers.Add(new MultiBuySpecialOffer(2, "B", 45)); // Act decimal total = calculator.Calculate(items, specialOffers); // Assert Assert.AreEqual(80, total); }
public void TestItemCanBeIdentifiedBySKU() { // Arrange var collection = new CheckOutItemCollection(); var a = new CheckoutItem("A", 50); var b = new CheckoutItem("B", 30); var c = new CheckoutItem("C", 20); var d = new CheckoutItem("D", 15); // Act collection.Add(a); collection.Add(b); collection.Add(c); collection.Add(d); // Assert Assert.AreEqual("A", collection["A"].SKU); Assert.AreEqual("B", collection["B"].SKU); Assert.AreEqual("C", collection["C"].SKU); Assert.AreEqual("D", collection["D"].SKU); }