[TestCase("33333", "Basic Account", 100, AccountType.Basic, -150, -60, true)] //(success, overdraft fee) public void BasicAccountWithdrawRuleTests(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw withdraw = new BasicAccountWithdrawRule(); Account account = new Account { AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType }; AccountWithdrawResponse response = withdraw.Withdraw(account, amount); Assert.AreEqual(expectedResult, response.Success); if (response.Success == true) { Assert.AreEqual(newBalance, response.Account.Balance); } }
public void BasicAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw withdrawal = new BasicAccountWithdrawRule(); Account accountWithdraw = new Account() { AccountNumber = accountNumber, Type = accountType, Balance = balance }; AccountWithdrawResponse response = withdrawal.Withdraw(accountWithdraw, amount); Assert.AreEqual(expectedResult, response.Success); }
public void BasicAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw withdrawRule = new BasicAccountWithdrawRule(); Account account = new Account(); account.AccountNumber = accountNumber; account.Name = name; account.Balance = balance; account.Type = accountType; AccountWithdrawResponse response = withdrawRule.Withdraw(account, amount); Assert.AreEqual(response.Success, expectedResult); }
public void BasicAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw myWithdraw = new BasicAccountWithdrawRule(); Account myAccount = new Account() { Name = name, AccountNumber = accountNumber, Balance = balance, Type = accountType }; AccountWithdrawResponse response = myWithdraw.Withdraw(myAccount, amount); Assert.AreEqual(expectedResult, response.Success); }
public void PremiumAccountWithdrawalRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw withdraw = new BasicAccountWithdrawRule(); 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 void BasicAccountWithdrawRuleTest(string acctNum, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw RuleTest = new BasicAccountWithdrawRule(); Account acct = new Account() { AccountNumber = acctNum, Name = name, Balance = balance, Type = accountType }; AccountWithdrawResponse response = RuleTest.Withdraw(acct, amount); bool actual = response.Success; Assert.AreEqual(expectedResult, actual); }
public void BasicAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal expectedBalance, bool expectedResult) { IWithdraw withdrawResponse = new BasicAccountWithdrawRule(); Account accountVariable = new Account() { AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType }; AccountWithdrawResponse accountWithdrawResponse = withdrawResponse.Withdraw(accountVariable, amount); Assert.AreEqual(expectedResult, accountWithdrawResponse.Success); Assert.AreEqual(expectedBalance, accountWithdrawResponse.Account.Balance); }
public void BasicAccountWithdrawTests(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw basicWithdraw = new BasicAccountWithdrawRule(); Account account = new Account() { AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType }; AccountWithdrawResponse result = basicWithdraw.Withdraw(account, amount); var actual = result.Success; var actual2 = account.Balance; Assert.AreEqual(expectedResult, actual); Assert.AreEqual(newBalance, actual2); }
public void BasicAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { var rule = new BasicAccountWithdrawRule(); var account = new Account() { AccountNumber = accountNumber, Name = name, Balance = balance, Type = accountType }; var response = rule.Withdraw(account, amount); Assert.AreEqual(expectedResult, response.Success); if (response.Success) { Assert.AreEqual(newBalance, response.Account.Balance); } }
public void PremiumAccountWithdrawRuleTest(string accountNumber, string name, decimal balance, AccountType accountType, decimal amount, decimal newBalance, bool expectedResult) { IWithdraw ruke = new BasicAccountWithdrawRule(); 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); if (adr.Success == true) { Assert.AreEqual(newBalance, balance); } ; }
public static void CorrectAmountDepositedWithdrawBasic(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 NoLimitDepositRule(); deposit.Deposit(a, 10); //stores new balance in account TestFileRepo.SaveAccount(a); Assert.AreEqual(a.Balance, 110); IWithdraw withdraw = new BasicAccountWithdrawRule(); withdraw.Withdraw(a, -10); TestFileRepo.SaveAccount(a); Assert.AreEqual(a.Balance, 100); }