예제 #1
0
        public void SavingsAccount_CreateSavingsAccountMethodWithMinimumBalance_ShouldSucceed()
        {
            //arrange
            var newSavingsAccount = new SavingsRepo();

            //act
            var expected = 300m;
            var actual   = newSavingsAccount.CreateSavingsAccountWithMinimumBalance("Jeffries", 123456);

            //assert
            Assert.AreEqual(expected, actual.Balance);
        }
예제 #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");
            }
        }