public void CostOfNormalBasketTest() { List <string> productsToScan = new List <string>() { "A", "B", "C", "D", "A", "B", "A" }; foreach (string product in productsToScan) { _terminal.ScanProduct(product); } Assert.AreEqual(13.25m, _terminal.CalculateTotal()); }
private void ProcessCustomer(Customer customer) { if (customer == null || string.IsNullOrWhiteSpace(customer.ShoppingList)) { return; } var productCodes = customer.ShoppingList.ToCharArray(); try { foreach (var code in productCodes) { Utils.DoSafe(() => { _terminal.ScanProduct(code.ToString()); }); } customer.Bill = _terminal.Bill; _terminal.CalculateTotal(); PrintBill(customer); } catch (Exception e) { Console.WriteLine(e.Message); } }