public async Task WithdrwalFromAccountOverdraftError() { ClearDbData(); CreateAccount ca = new CreateAccount(_account, _bankDBContext); await ca.ExecuteCommand(); //Deposit 250 double amount = 250.0; Deposit depoist = new Deposit(_account, amount, "GBP", "Added GBP funds", _bankDBContext); await depoist.ExecuteCommand(); double amountToWithdraw = 300.0; try { Withdraw withdraw = new Withdraw(_account, amountToWithdraw, "Funds withdrwan", _bankDBContext); await withdraw.ExecuteCommand(); } catch (Exception ex) { string expectedError = string.Format(ErrorMessages.OVERDRAFTERROR, amountToWithdraw); Assert.IsTrue(expectedError == ex.Message); } }
public async Task WithdrwalFromAccountLessThanBalance() { ClearDbData(); CreateAccount ca = new CreateAccount(_account, _bankDBContext); await ca.ExecuteCommand(); //Deposit 250 double amount = 250.0; Deposit depoist = new Deposit(_account, amount, "GBP", "Added GBP funds", _bankDBContext); await depoist.ExecuteCommand(); double amountToWithdraw = 200.0; Withdraw withdraw = new Withdraw(_account, amountToWithdraw, "Funds withdrwan", _bankDBContext); await withdraw.ExecuteCommand(); Assert.IsTrue(withdraw.IsCommandCompleted && _account.AccountBalance == 50); }