Beispiel #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");
            }
        }
        public void CheckingAccount_CheckingAccountGetAll_ShouldSucceed()
        {
            //arrange
            var newCheckingAccount = new CheckingRepo();
            var checkingOne        = new Checking("Jeffries", 1000, 121212);
            var checkingTwo        = new Checking("Sharp", 2000, 221212);
            var checkingThree      = new Checking("Stewart", 3000, 331212);

            newCheckingAccount.AddAccountToCheckingList(checkingOne);
            newCheckingAccount.AddAccountToCheckingList(checkingTwo);
            newCheckingAccount.AddAccountToCheckingList(checkingThree);


            //act
            var expected = 3;
            var actual   = newCheckingAccount.GetAllCheckingAccounts().Count;

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