Пример #1
0
        public void SearchAllCustomersInList_ShouldSucceed()
        {
            //arrange
            var bankService           = new BankService();
            var newSavingsAccountOne  = new Savings("Jeffries", 1000, 121212);
            var newSavingsAccountTwo  = new Savings("Sharp", 2000, 221212);
            var newCheckingAccountOne = new Checking("Jeffries", 2500, 343434);

            bankService.AddAccountToMasterList(newSavingsAccountOne);
            bankService.AddAccountToMasterList(newSavingsAccountOne);
            bankService.AddAccountToMasterList(newSavingsAccountOne);

            //act
            var expected = 3;
            var actual   = bankService.GetAllAccounts().Count;

            //assert
            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void CreateNewAccount()
        {
            _console.WriteLine("What account do you want to create? \r\n " +
                               "1. Savings \r\n " +
                               "2. Checking \r\n");

            var command = _console.ReadLine();

            if (command == "1")
            {
                _console.WriteLine("Create account with minimum balance? (Y/N)");
                var savingTypeCommand = _console.ReadLine().ToUpper();

                if (savingTypeCommand == "Y")
                {
                    _console.WriteLine("Enter last name:");
                    var nameInput = _console.ReadLine();

                    _console.WriteLine("Enter ID:");
                    var idInput = Convert.ToInt32(_console.ReadLine());

                    var newSavingsAccount = SavingsRepo.CreateSavingsAccountWithMinimumBalance(nameInput, idInput);
                    BankService.AddAccountToMasterList(newSavingsAccount);
                    SavingsRepo.AddAccountToSavingsList(newSavingsAccount);
                    _console.WriteLine("Account created");
                }
                else if (savingTypeCommand == "N")
                {
                    _console.WriteLine("Enter last name:");
                    var nameInput = _console.ReadLine();

                    _console.WriteLine("Enter balance:");
                    var balanceInput = Convert.ToDecimal(_console.ReadLine());

                    _console.WriteLine("Enter ID:");
                    var idInput = Convert.ToInt32(_console.ReadLine());

                    var newSavingsAccount = SavingsRepo.CreateSavingsAccount(nameInput, balanceInput, idInput);
                    BankService.AddAccountToMasterList(newSavingsAccount);
                    SavingsRepo.AddAccountToSavingsList(newSavingsAccount);
                    _console.WriteLine("Account created");
                }
                else
                {
                    _console.WriteLine("Please enter a valid option");
                }
            }
            else if (command == "2")
            {
                _console.WriteLine("Enter last name:");
                var nameInput = _console.ReadLine();

                _console.WriteLine("Enter balance:");
                var balanceInput = Convert.ToDecimal(_console.ReadLine());

                _console.WriteLine("Enter ID:");
                var idInput = Convert.ToInt32(_console.ReadLine());

                var newCheckingAccount = CheckingRepo.CreateCheckingAccount(nameInput, balanceInput, idInput);
                BankService.AddAccountToMasterList(newCheckingAccount);
                CheckingRepo.AddAccountToCheckingList(newCheckingAccount);
                _console.WriteLine("Account created");
            }
            else
            {
                _console.WriteLine("Please enter a valid option");
            }
        }