Esempio n. 1
0
        public void Deposit()
        {
            _console.WriteLine("What account do you want to deposit into: \r\n " +
                               "1. Savings\r\n " +
                               "2. Checking");
            var command = _console.ReadLine().ToLower();

            if (command == "1")
            {
                if (SavingsRepo.GetAllSavingsAccounts().Count == 0)
                {
                    _console.WriteLine("No Accounts Present");
                    return;
                }

                _console.WriteLine("Please select account to deposit funds:");
                var accountInput = Convert.ToInt32(_console.ReadLine());

                //validates savings account, then deposits funds
                if (SavingsRepo.ValidateSavingsAccount(accountInput))
                {
                    ValidatedSavingsAccountAndDeposit(accountInput);
                }
                else
                {
                    _console.WriteLine("Account not present");
                }
            }
            else if (command == "2")
            {
                //checks if accounts are present
                if (CheckingRepo.GetAllCheckingAccounts().Count == 0)
                {
                    _console.WriteLine("No Accounts Present");
                    return;
                }

                _console.WriteLine("Please select account to deposit funds:");
                var accountInput = Convert.ToInt32(_console.ReadLine());

                //validates checking account, then deposits funds
                if (CheckingRepo.ValidateCheckingAccount(accountInput))
                {
                    ValidatedCheckingAccountAndDeposit(accountInput);
                }
                else
                {
                    _console.WriteLine("Account not present");
                }
            }
            else
            {
                _console.WriteLine("Please enter a valid option");
            }
        }
Esempio n. 2
0
        public void SavingsAccount_GetAllSavingsAccounts_ShouldSucceed()
        {
            //arrange
            var savingsAccount  = new Savings("Jeffries", 20000m, 233456);
            var savingsAccount1 = new Savings("Sharp", 3000m, 123456);
            var savingsAccount2 = new Savings("Stewart", 4000m, 223456);
            var savingsRepo     = new SavingsRepo();

            savingsRepo.AddAccountToSavingsList(savingsAccount);
            savingsRepo.AddAccountToSavingsList(savingsAccount1);
            savingsRepo.AddAccountToSavingsList(savingsAccount2);

            //act
            var expected = 3;
            var actual   = savingsRepo.GetAllSavingsAccounts().Count;

            //assert
            Assert.AreEqual(expected, actual);
        }