public static Customer CreateValidCustomer() { return(new Customer("1234567890", "Rasmus Naver", new List <Account>() { CheckingAccountTestClass.CreateValidCheckingAccount(), SavingAccountTestClass.CreateValidSavingAccount() })); }
public void TransactionDateTimeIsInTheFutureTest() { CheckingAccount account1 = CheckingAccountTestClass.CreateValidCheckingAccount(); CheckingAccount account2 = CheckingAccountTestClass.CreateValidCheckingAccount(); Transaction transaction = new Transaction(1, new DateTime(2019, 1, 1), account1, account2); }
public void TransactionAmountEqualToOrLessThanZeroTest() { CheckingAccount account1 = CheckingAccountTestClass.CreateValidCheckingAccount(); CheckingAccount account2 = CheckingAccountTestClass.CreateValidCheckingAccount(); Transaction transaction = new Transaction(0, DateTime.Now, account1, account2); }
public void AccountPerformTransactionWhenTransactionAmountExceedsBalanceOfTransmittingAccount() { CheckingAccount account1 = CheckingAccountTestClass.CreateValidCheckingAccount(); CheckingAccount account2 = CheckingAccountTestClass.CreateValidCheckingAccount(); Transaction transaction = new Transaction(500, DateTime.Now, account1, account2); account1.PerformTransaction(transaction); }
public void AccountPerformTransactionDoesNotIncludeActingAccount() { CheckingAccount account1 = CheckingAccountTestClass.CreateValidCheckingAccount(); CheckingAccount account2 = CheckingAccountTestClass.CreateValidCheckingAccount(); CheckingAccount account3 = CheckingAccountTestClass.CreateValidCheckingAccount(); Transaction transaction = new Transaction(1, DateTime.Now, account1, account2); account3.PerformTransaction(transaction); }
public void ValidInputConstructorTest() { CheckingAccount account1 = CheckingAccountTestClass.CreateValidCheckingAccount(); CheckingAccount account2 = CheckingAccountTestClass.CreateValidCheckingAccount(); Transaction transaction = new Transaction(1, DateTime.Now, account1, account2); Assert.AreEqual("137", transaction.Transmitter.AccountNumber); }
public void CustomerCalculateCostOfMonthTest() { Customer customer = CreateValidCustomer(); CheckingAccount checkingAccount = CheckingAccountTestClass.CreateValidCheckingAccount(); decimal transactionCost = customer.TransactionCost; decimal monthlyCost = customer.MonthlyAccountFee; decimal numberOfTransactionFees = 0; Transaction transaction1 = new Transaction(1, DateTime.Now, customer.Accounts[0], checkingAccount); Transaction transaction2 = new Transaction(1, DateTime.Now, customer.Accounts[1], checkingAccount); int numberOfTransaction1Performed = 21; int numberOfTransaction2Performed = 2; for (int i = 0; i < numberOfTransaction1Performed; i++) { customer.Accounts[0].PerformTransaction(transaction1); } for (int i = 0; i < numberOfTransaction2Performed; i++) { customer.Accounts[1].PerformTransaction(transaction2); } foreach (Account a in customer.Accounts) { if (a is CheckingAccount && a.Transactions.Count > CheckingAccount.noMonthlyFreeTransactions) { numberOfTransactionFees += a.Transactions.Count - CheckingAccount.noMonthlyFreeTransactions; } else { numberOfTransactionFees += a.Transactions.Count; } } Month month = (Month)DateTime.Now.Month; decimal costOfMonth = customer.CalculateCostOfMonth(month); Assert.AreEqual((monthlyCost * customer.Accounts.Count) + (transactionCost * numberOfTransactionFees), costOfMonth); }