public void TotalForSpecialPrice() { Dictionary<string, int> saleRules = new Dictionary<string, int>(); PricingRules pricingRules = new PricingRules(saleRules); Checkout ck = new Checkout(pricingRules); Item itemA = new Item { sku = "A", price = 50 }; ck.scan(itemA); ck.scan(itemA); //whenever scan is called the item price is added to the total from the Checkout class ck.scan(itemA); ck.getTotal().Should().Be.EqualTo(150); }
public void TotalForNonSaleItems() { Dictionary<string, int> saleRules = new Dictionary<string, int>(); PricingRules pricingRules = new PricingRules(saleRules); Checkout ck = new Checkout(pricingRules); Item itemA = new Item { sku = "A", price = 50 }; Item itemB = new Item { sku = "B", price = 30 }; ck.scan(itemA); ck.scan(itemB); ck.scan(itemA); ck.getTotal().Should().Be.EqualTo(130); }
public Checkout(PricingRules pricingRules) { _pricingRules = pricingRules; }