public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw withdrawal = new FreeAccountWithdrawRule(); Account accountWithdraw = new Account() { AccountNumber = accountNumber, Type = accountType, Balance = balance }; AccountWithdrawResponse response = withdrawal.Withdraw(accountWithdraw, amount); Assert.AreEqual(expectedResult, response.Success); }
public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType type, decimal amount, decimal newBalance, bool expected) { IWithdraw withdraw = new FreeAccountWithdrawRule(); Account account = new Account() { AccountNumber = accountNumber, Name = name, Balance = balance, Type = type }; AccountWithdrawResponse response = withdraw.Withdraw(account, amount); Assert.AreEqual(expected, response.Success); Assert.AreEqual(newBalance, response.Account.Balance); }
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 respone = withdraw.Withdraw(account, amount); Assert.AreEqual(expectedResult, respone.Success); }
[TestCase("12345", "Free Account", 100, AccountType.Free, -50, true)] //success public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw myWithdrawRule = new FreeAccountWithdrawRule(); Account myAccount = new Account() { AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType }; AccountWithdrawResponse response = myWithdrawRule.Withdraw(myAccount, amount); Assert.AreEqual(expectedResult, response.Success); }
public void FreeAccountWithdrawalRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw ruke = new FreeAccountWithdrawRule(); Account juke = new Account(); juke.AccountNumber = accountNumber; juke.Name = name; juke.Balance = balance; juke.Type = accountType; AccountWithdrawResponse adr = ruke.Withdraw(juke, amount); Assert.AreEqual(expectedResult, adr.Success); }
public void FreeAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, bool expectedResult) { IWithdraw withdrawTest = new FreeAccountWithdrawRule(); Account account = new Account() { AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType }; AccountWithdrawResponse result = withdrawTest.Withdraw(account, amount); var actual = result.Success; Assert.AreEqual(expectedResult, actual); }
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 expectedResult) { IWithdraw withdraw; FreeAccountWithdrawRule withdrawRule = new FreeAccountWithdrawRule(); withdraw = withdrawRule; Account account = new Account { Name = name, Balance = balance, AccountNumber = accountNumber, Type = accountType }; AccountWithdrawResponse actualResult = withdraw.Withdraw(account, amount); Assert.AreEqual(expectedResult, actualResult.Success); }
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); } }