Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 public Checkout(PricingRules pricingRules)
 {
     _pricingRules = pricingRules;
 }