private void addProduct(string pluno, double qty, double price) { string str = getID() + ". Product " + pluno + ": " + qty + " * " + price; listCashier.Items.Add(new KeyValuePair <int, string>(-1, str)); lblInSale.Text = _engine.AddItem(pluno, qty, price, checkBox1.Checked); }
/* * - tests for lowered price discount * - tests for buy and get (simple) * - tests for buy and get (advanced) * - tests for recurrences * - tests for multiple instances (w/o minimum != 0) * - tests for remove item from cart */ public bool test1_1() { // Sale 1.1 - Lowered price - 10 NIS discount on any '1_1' product string saleName = "Sale 1.1"; InitTest(); AddDiscount(saleName, 1, 10); _eng.AddItem("1_1", 1, 100); if (!CompareCarts("first insert")) { return(false); } AddDiscount(saleName, 2, 10); _eng.AddItem("1_1", 2, 100); if (!CompareCarts("second insert")) { return(false); } //not effecting _eng.AddItem("1_0", 1000, 100); if (!CompareCarts("insert unrelated")) { return(false); } AddDiscount(saleName, 10, 10); _eng.AddItem("1_1", 10, 100); if (!CompareCarts("third insert")) { return(false); } RemoveDiscount(saleName, 3, 10); _eng.RemoveItem("1_1", 3); if (!CompareCarts("removing item")) { return(false); } _eng.RemoveItem("1_0", 10); if (!CompareCarts("removing unrelated")) { return(false); } return(true); }
public void addProduct(string pluno, double qty, double price) { Items.Add(new CashierItem(pluno, pluno, qty, price, CashierItemType.Product)); _engine.AddItem(pluno, qty, price); }