示例#1
0
        public void SavingsAccount_CreateAdditionalSavingsAccountMethod_ShouldSucceed()
        {
            //arrange
            var newSavingsAccount = new SavingsRepo();

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

            //assert
            Assert.AreEqual(expected, actual.Balance);
        }
示例#2
0
 public void SavingsAccount_CreationOfSavingsAccountWithout300DollarWillThrowException_ShouldSucceed()
 {
     //arrange
     var newSavingsRepo = new SavingsRepo();
     var savingsAccount = newSavingsRepo.CreateSavingsAccount("Jeffries", 200m, 123456);
 }
示例#3
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");
            }
        }