public void Calculate_Total() { Item firstCoffee = new Item("C40:Coffee", 00.60m, 1); Item secondCoffee = new Item("C40:Coffee", 00.60m, 1); testCheckout.ScanItem(firstCoffee); testCheckout.ScanItem(secondCoffee); Assert.AreEqual(testCheckout.CalculateTotal(), 01.20m); }
public void TestCheckoutWithSpecialPriceCriteriaMetReturnsSpecialPrice() { checkout.AddPricingRule(ItemARule); AddItems(3, itemA); int result = checkout.CalculateTotal(); Assert.Equal(130, result); }
public void Pricing_NoItemsScanned_Calculates0() { decimal expected = 0.00M; var checkout = new Checkout(); decimal actual = checkout.CalculateTotal(); Assert.Equal(expected, actual); }
public void TestCalculateTotalPrice_Empty() { // Arrange ICheckout checkout = new Checkout(); // Act var total = checkout.CalculateTotal(); // Assert Assert.AreEqual(0, total); }
public void CalculateTotal_StandardCall_ResultAsExpected() { // Arrange var expected = 0.0; // Act var actual = _checkout.CalculateTotal(); // Assert actual.Should().Be(expected); }
public void TestCalculateTotalPrice() { // Arrange ICheckout checkout = new Checkout(); checkout.AddItem(new CheckoutItem("A", 50)); checkout.AddItem(new CheckoutItem("B", 30)); // Act var total = checkout.CalculateTotal(); // Assert Assert.AreEqual(80, total); }
public void TestSpecialOffersAreApplied() { // Arrange ICheckout checkout = new Checkout(); checkout.AddItem(new CheckoutItem("B", 30)); checkout.AddItem(new CheckoutItem("A", 50)); checkout.AddItem(new CheckoutItem("B", 30)); // Act checkout.AddSpecialOffer(new MultiBuySpecialOffer(2, "B", 45)); // Assert Assert.AreEqual(95, checkout.CalculateTotal()); }
public void TestSpecialOffersAreApplied_WithAdditionalItemsNotCoveredByOffer() { // Arrange ICheckout checkout = new Checkout(); checkout.AddItem(new CheckoutItem("B", 30)); checkout.AddItem(new CheckoutItem("A", 50)); checkout.AddItem(new CheckoutItem("B", 30)); checkout.AddItem(new CheckoutItem("B", 30)); // Act checkout.AddSpecialOffer(new MultiBuySpecialOffer(2, "B", 45)); // Assert Assert.AreEqual(125, checkout.CalculateTotal()); }
public void Pricing_SimpleItemPricing_CalculatesPrice() { decimal expected = 10.00M; var sku = new Sku("Item 1"); var item = new Item(sku, 5.00M, new DefaultPricingRule()); var checkout = new Checkout(item); checkout.Scan(sku); checkout.Scan(sku); decimal actual = checkout.CalculateTotal(); Assert.Equal(expected, actual); }
public void Pricing_TwoForOne_CalculatesCorrectPrice() { decimal expected = 10.00M; var sku = new Sku("2 for 1 Item"); var twoForOnePricingRule = new XForYPricingRule(2, 1); var twoForOneItem = new Item(sku, 10.00M, twoForOnePricingRule); var checkout = new Checkout(twoForOneItem); checkout.Scan(sku); checkout.Scan(sku); decimal actual = checkout.CalculateTotal(); Assert.Equal(expected, actual); }
public void Pricing_ThreeForTwo_CalculatesCorrectPrice() { decimal expected = 20.00M; var sku = new Sku("3 for 2 Item"); var threeForTwoPricingRule = new XForYPricingRule(3, 2); var threeForTwoItem = new Item(sku, 10.00M, threeForTwoPricingRule); var checkout = new Checkout(threeForTwoItem); checkout.Scan(sku); checkout.Scan(sku); checkout.Scan(sku); decimal actual = checkout.CalculateTotal(); Assert.Equal(expected, actual); }
public void CalculateTotalTest80() { Checkout checkout = new Checkout("AB"); Assert.AreEqual(80, checkout.CalculateTotal(), 0.0001); }
public void CalculateTotalTest175() { Checkout checkout = new Checkout("AAABB"); Assert.AreEqual(175, checkout.CalculateTotal(), 0.0001); }
public void CalculateTotalTest115() { Checkout checkout = new Checkout("CDBA"); Assert.AreEqual(115, checkout.CalculateTotal(), 0.0001); }
public void CalculateTotalTest100Lower() { Checkout checkout = new Checkout("aa"); Assert.AreEqual(100, checkout.CalculateTotal(), 0.0001); }
public void ScanOneApple() { basket.Scan("A99"); Assert.AreEqual(50, checkout.CalculateTotal()); }
public void Calculates_total_owed() { checkout.CalculateTotal(basketItems, productList); Assert.AreEqual(checkout.total, 2.6m); }
public void CalculateTotalTest115Extra() { Checkout checkout = new Checkout("ABCDEF"); Assert.AreEqual(115, checkout.CalculateTotal(), 0.0001); }