Ejemplo n.º 1
0
        public void CreateAccount(string accountName, AccountType accountType)
        // create a new account
        {
            AccountBase newAccount = AccountBase.CreateAccount(accountType);

            accountsDictionary.Add(accountName, newAccount);
        }
        public void CreateAccountSetsBalanceToZero()
        {
            // Arrange
            AccountBase testAccount = AccountBase.CreateAccount(AccountType.Silver);
            // Act
            decimal balance = testAccount.Balance;

            // Assert
            Assert.AreEqual(balance, 0.00M);
        }
        public void DepositToAccountBalance()
        {
            // Arrange
            AccountBase testAccount = AccountBase.CreateAccount(AccountType.Silver);

            // Act
            testAccount.AddTransaction(+123.45M);
            decimal balance = testAccount.Balance;

            // Assert
            Assert.AreEqual(balance, +123.45M);
        }
        public void RewardPoints_Silver_Deposit()
        {
            // Arrange
            AccountBase testAccount = AccountBase.CreateAccount(AccountType.Silver);

            // Act
            testAccount.AddTransaction(1000M);
            testAccount.AddTransaction(1000M);
            int points = testAccount.RewardPoints;

            // Assert
            Assert.AreEqual(points, 200);
        }
        public void NegativeBalanceAllowed()
        {
            // Arrange
            AccountBase testAccount = AccountBase.CreateAccount(AccountType.Silver);

            // Act
            testAccount.AddTransaction(+200M);
            testAccount.AddTransaction(-500M);
            decimal balance = testAccount.Balance;

            // Assert
            Assert.AreEqual(balance, -300M);
        }
        public void WithdrawalToAccountBalance()
        {
            // Arrange
            AccountBase testAccount = AccountBase.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
            AccountBase testAccount = AccountBase.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
            AccountBase testAccount = AccountBase.CreateAccount(AccountType.Gold);

            // Act
            testAccount.AddTransaction(4000M);
            testAccount.AddTransaction(4000M);
            int points = testAccount.RewardPoints;

            // Assert
            Assert.AreEqual(points, 800 + 2 + 800);
        }
        public void CreateAccount(AccountType accountType)
        {
            var newAccount = AccountBase.CreateAccount(accountType);

            accountRepository.NewAccount(newAccount);
        }