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 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 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 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);
        }
Example #6
0
        public void Deposit(string accountName, decimal amount)
        // deposit the given account into the account named
        {
            AccountBase acc = FindAccount(accountName);

            acc.AddTransaction(amount);
        }
        public void Withdrawal(string accountName, decimal amount)
        // withdrawal the given account into the account named
        {
            AccountBase acc = FindAccount(accountName);

            acc.AddTransaction(-amount);
        }
        public void Withdrawal(string accountName, decimal amount)
        // withdrawal the given account into the account named
        {
            AccountBase acc = FindAccount(accountName); //find the account

            acc.AddTransaction(amount * -1);            //subtract the amount from the account balance
        }
        /// <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)
        {
            AccountBase acc = FindAccount(accountName);

            // for withdrawal, subtract amount
            acc.AddTransaction(-1 * amount);
        }
Example #10
0
        public void Withdrawal(string accountName, decimal amount)
        // withdrawal the given account into the account named
        {
            //takes account name and adds transaction: parameters are multiplied by -1 for that it is subtracted from account
            AccountBase acc = FindAccount(accountName);

            acc.AddTransaction(amount * -1);
        }
Example #11
0
        public void Withdrawal(string accountName, decimal amount)
        // withdrawal the given account into the account named
        {
            // throw new NotImplementedException();
            AccountBase acc = FindAccount(accountName);
            decimal     withdrawalAmount = -(amount);

            acc.AddTransaction(withdrawalAmount);
        }
Example #12
0
        public void Withdrawal(string accountName, decimal amount)
        // withdrawal the given account into the account named
        {
            // User Story: As a account holder I want to make withdrawals so that my reward balance does not get negatively effected.

            AccountBase acc = FindAccount(accountName);

            // I added an if statement in AccountBase.AddTransaction so that
            // negative amounts won't effect reward points
            acc.AddTransaction(0 - amount);
        }
        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 Withdrawal(string accountName, decimal amount)
        // withdrawal the given account into the account named
        {
            AccountBase acc = FindAccount(accountName);

            //Check if withdrawl would leave them with less than $0
            if (acc.Balance - amount >= 0)
            {
                //Deposit amount by -1, which acts as a withdrawl
                acc.AddTransaction(amount * -1);
            }
        }
        /// <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)
        {
            AccountBase acc = FindAccount(accountName);

            acc.AddTransaction(amount);
        }