public void RewardPoints_Silver_Deposit() { // Arrange iAccount testAccount = accountFactory.CreateAccount(AccountType.Silver); // Act testAccount.AddTransaction(1000M); testAccount.AddTransaction(1000M); int points = testAccount.RewardPoints; // Assert Assert.AreEqual(points, 200); }
public void NegativeBalanceAllowed() { // Arrange iAccount testAccount = accountFactory.CreateAccount(AccountType.Silver); // Act testAccount.AddTransaction(+200M); testAccount.AddTransaction(-500M); decimal balance = testAccount.Balance; // Assert Assert.AreEqual(balance, -300M); }
public void WithdrawalToAccountBalance() { // Arrange iAccount testAccount = accountFactory.CreateAccount(AccountType.Silver); // Act testAccount.AddTransaction(+200M); testAccount.AddTransaction(-100M); decimal balance = testAccount.Balance; // Assert Assert.AreEqual(balance, +100M); }
public void RewardPoints_Platinum_Deposit() { // Arrange iAccount testAccount = accountFactory.CreateAccount(AccountType.Platinum); // Act testAccount.AddTransaction(4000M); testAccount.AddTransaction(4000M); int points = testAccount.RewardPoints; // Assert Assert.AreEqual(points, 2000 + 4 + 2000); }
public void RewardPoint_Gold_Deposit() { // Arrange iAccount testAccount = accountFactory.CreateAccount(AccountType.Gold); // Act testAccount.AddTransaction(4000M); testAccount.AddTransaction(4000M); int points = testAccount.RewardPoints; // Assert Assert.AreEqual(points, 800 + 2 + 800); }
/// <summary> /// withdrawal the given account into the account named /// </summary> /// <param name="accountName"></param> /// <param name="amount"></param> public void Withdrawal(string accountName, decimal amount) { iAccount acc = FindAccount(accountName); // for withdrawal, subtract amount acc.AddTransaction(-1 * amount); }
public void DepositToAccountBalance() { // Arrange iAccount testAccount = accountFactory.CreateAccount(AccountType.Silver); // Act testAccount.AddTransaction(+123.45M); decimal balance = testAccount.Balance; // Assert Assert.AreEqual(balance, +123.45M); }
/// <summary> /// deposit the given account into the account named /// </summary> /// <param name="accountName"></param> /// <param name="amount"></param> public void Deposit(string accountName, decimal amount) { iAccount acc = FindAccount(accountName); acc.AddTransaction(amount); }