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 DespoistToAccountWithAnotherCurrency() { ClearDbData(); CreateAccount ca = new CreateAccount(_account, _bankDBContext); await ca.ExecuteCommand(); double amount = 250.0; Deposit depoist = new Deposit(_account, amount, "USD", "Added Usd funds", _bankDBContext, _exchangeRate); await depoist.ExecuteCommand(); Assert.IsTrue(depoist.IsCommandCompleted && _account.AccountBalance > 250.0); }
public async Task CreateAccount() { //var model = PrepareDB(); //Delete if already exists ClearDbData(); CreateAccount ca = new CreateAccount(_account, _bankDBContext); await ca.ExecuteCommand(); var dbBankAccount = _bankDBContext.Accounts.Select(r => r.AccountNo == _account.AccountNo); Assert.IsTrue(ca.IsCommandCompleted && dbBankAccount.Count() == 1); }
public async Task DespoistToAccountWithLocalCurrency() { ClearDbData(); //Add account to update CreateAccount ca = new CreateAccount(_account, _bankDBContext); await ca.ExecuteCommand(); double amount = 250.0; Deposit depoist = new Deposit(_account, amount, "GBP", "Added gbp funds", _bankDBContext); await depoist.ExecuteCommand(); Assert.IsTrue(_account.AccountBalance == 250.0 && depoist.IsCommandCompleted); }
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); }