public void UpdateDiscountMoreThanAmount() { AddMultipleProducts(); double balance = 0; bool isUpdated = mainDBHelper.UpdateAdvance(180, out balance); Assert.IsTrue(isUpdated, "Updation should happen when the advance is lesser or equal to total"); bool isDiscountUpdated = mainDBHelper.UpdateDiscount(30, out balance); Assert.IsFalse(isDiscountUpdated, "Updation should not happen when the advance + discount is greater than total"); Assert.AreEqual("180", mainDBHelper.GetAdvance(), "Internal values messed up."); Assert.AreEqual("10", mainDBHelper.GetBalance(), "Internal values messed up."); Assert.AreEqual("0", mainDBHelper.GetDiscount(), "Internal values messed up."); }
public void UpdateDiscount(double discount) { double balance = 0; bool isUpdateSuccess = dbHelper.UpdateDiscount(discount, out balance); if (isUpdateSuccess) { view.UpdateBalance(balance.ToString()); } else { view.UpdateDiscount(""); dialogHelper.ShowError("Pay exceeds total amount", "Data Entry Error!!!"); } }