public void TestWithdrawW4() { long accountNo = 123; double balance = 1000.00; double interestRate = 0.5; Account a = new Account(accountNo, balance, interestRate); try { a.Withdraw(0); Assert.Fail("Should throw an exception"); } catch (InvalidAmountOrBalanceException) { } }
public void TestWithdrawW2() { long accountNo = 123; double balance = 1000.00; double interestRate = 0.5; Account a = new Account(accountNo, balance, interestRate); a.Withdraw(1000); double expected = 0; double actual = a.Balance; Assert.AreEqual(expected, actual); }