public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw deposit = new FreeAccountWithdrawRule(); Account account = new Account(); account.AccountNumber = accountNumber; account.Type = accountType; account.Name = name; account.Balance = balance; AccountWithdrawResponse response = deposit.Withdraw(account, amount); Assert.AreEqual(expectedResult, response.Success); }
public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw withdraw = new FreeAccountWithdrawRule(); Account account = new Account(); account.AccountNumber = accountNumber; account.Name = name; account.Balance = balance; account.Type = accountType; AccountWithdrawResponse response = withdraw.Withdraw(account, amount); Assert.AreEqual(expectedResult, response.Success); Assert.AreEqual(account.Balance, newBalance);//testing expected balance accuracy }
public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw withdraw = new FreeAccountWithdrawRule(); Account account = new Account() { AccountNumber = accountNumber, Name = name, Type = accountType, Balance = balance }; AccountWithdrawResponse response = withdraw.Withdraw(account, amount); Assert.AreEqual(expectedResult, response.Success); }
public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw withdraw = new FreeAccountWithdrawRule(); Account account = new Account(); account.AccountNumber = accountNumber; account.Name = name; account.Balance = balance; account.Type = accountType; AccountWithdrawResponse accountWithdraw = withdraw.Withdraw(account, amount); Assert.That(accountWithdraw.Success, Is.EqualTo(expectedResult)); }
public static void CorrectAmountDepositAndWithdrawFree(string accountNumber) { //after this files are in arraylist FileAccountRepository TestFileRepo = new FileAccountRepository("C:/Users/Jeremy/source/repos/SGBank052020/SGBank.Data/AccountsForTestingDeposit.txt"); Account a = TestFileRepo.LoadAccount(accountNumber); decimal beginningBalance = a.Balance; //100 IDeposit deposit = new FreeAccountDepositRule(); deposit.Deposit(a, 10); //stores new balance in account TestFileRepo.SaveAccount(a); Assert.AreEqual(a.Balance, 110); IWithdraw withdraw = new FreeAccountWithdrawRule(); withdraw.Withdraw(a, -10); TestFileRepo.SaveAccount(a); Assert.AreEqual(a.Balance, 100); }
public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expected) { IWithdraw withdraw = new FreeAccountWithdrawRule(); Account account = new Account(); account.AccountNumber = accountNumber; account.Name = name; account.Balance = balance; account.Type = accountType; AccountWithdrawResponse response = withdraw.Withdraw(account, amount); Assert.AreEqual(expected, response.Success); if (response.Success) { Assert.AreEqual(response.Account.Balance, response.OldBalance += amount); } else { Assert.AreEqual(balance, account.Balance); } }