コード例 #1
0
        public void UpdateQuantityProductExist()
        {
            double amount = 0;

            mainDBHelper.InitializeNewBillEntry("Suresh", true);
            bool isAdded = true;

            isAdded &= mainDBHelper.AddProduct("Selfie", out amount);
            isAdded &= mainDBHelper.AddProduct("PhotoFrame", out amount);
            isAdded &= mainDBHelper.AddProduct("ProfilePic", out amount);
            mainDBHelper.UpdateQuantity("Selfie", 3, out amount);
            Assert.IsTrue(isAdded, "Products not added to Bill entry, when it exists in database.");
            Assert.AreEqual(150, amount, "Amount for the product not equal to the expected value.");
            Assert.AreEqual("290", mainDBHelper.GetTotalAmount(), "Amount for the products not equal to the expected value.");
        }
コード例 #2
0
        public void UpdateQuantity(string productName, double value)
        {
            double amount = 0;

            if (string.IsNullOrEmpty(productName))
            {
                dialogHelper.ShowError("Internal Error Occurred", "Message");
            }
            else
            {
                dbHelper.UpdateQuantity(productName, value, out amount);
                view.UpdateAmount(amount);
                UpdateValues();
            }
        }