static void Main(string[] args) { PricingRules pricingRules = new PricingRules(); Console.WriteLine("============>Stating execution <============"); Console.WriteLine("Pricing table"); Console.WriteLine("Item | Unit Price | Special Price"); foreach (var item in pricingRules.pricingList) { Console.WriteLine(item.Key + " |" + item.Value.price + " |" + item.Value.specialPriceCont + " for " + item.Value.specialPrice); } CheckOut checkOut = new CheckOut(pricingRules); Console.WriteLine(); Console.WriteLine("Scaning products"); Console.WriteLine("A"); checkOut.Scan("A"); Console.WriteLine("B"); checkOut.Scan("B"); Console.WriteLine("A"); checkOut.Scan("A"); Console.WriteLine("A"); checkOut.Scan("A"); Console.WriteLine("Total price : " + checkOut.Total()); Console.ReadLine(); }
public void Scan_ThreeASkus_TotalIs130() { var calculator = new Calculator(); var checkout = new CheckOut(this, calculator); _productPriceToReturn = 50; checkout.Scan("A"); checkout.Scan("A"); checkout.Scan("A"); Assert.AreEqual(130, calculator.Total()); }
public void ScanTwoItems_TotalIs80() { var calculator = new Calculator(); var checkout = new CheckOut(this, calculator); _productPriceToReturn = 50; checkout.Scan("A"); _productPriceToReturn = 30; checkout.Scan("B"); Assert.That(calculator.Total(), Is.EqualTo(80)); }
public void ScanMultipleDiscountedItems() { var calculator = new Calculator(); var checkout = new CheckOut(this, calculator); _productPriceToReturn = 50; checkout.Scan("A"); checkout.Scan("A"); checkout.Scan("A"); checkout.Scan("A"); Assert.AreEqual(180, calculator.Total()); }