public void CheckingAccount_CreateAdditionalCheckingAccountMethod_ShouldSucceed()
        {
            //arrange
            var newCheckingAccount = new CheckingRepo();

            //act
            var expected = 1000m;
            var actual   = newCheckingAccount.CreateCheckingAccount("Jeffries", 1000m, 123456);

            //assert
            Assert.AreEqual(expected, actual.Balance);
        }
Exemplo n.º 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");
            }
        }