public void Account_withdraw_within_overdraft_limit() { //arrange Account a = new Omni(1000, (decimal).10, 10, 100); //act a.Withdraw(1050); //assert decimal expected = -50; decimal actual = a.Balance; Assert.AreEqual(expected, actual); }
public void Account_withdraw_outside_overdraft_limit() { //arrange Account a = new Omni(1000, (decimal).10, 10, 100); //act string actual; try { actual = a.Withdraw(1150); Assert.Fail(); // should throw exception, if code reaches here fail test } catch (Exception e) { actual = e.Message; } //assert string expected = "Omni " + a.ID.ToString() + "; withdrawal $1150; transaction failed; fee 10; balance $990"; Assert.AreEqual(expected, actual); }
private void withdrawButton_Click(object sender, EventArgs e) { o.Withdraw(Convert.ToInt32(numericUpDown1.Text)); textBox1.Text = o.WithdrawInfo(Convert.ToInt32(numericUpDown1.Text), o.accounttype); }