public void CanDepositMoney()
        {
            var ops = new AccountOperations();
            var loadAccountResponse = ops.GetAccount("2");
            var request = new DepositRequest();
            request.Account = loadAccountResponse.Data;
            request.DepositAmount = 100.00M;
            var depositResponse = ops.MakeDeposit(request);

            var reloadAccount = ops.GetAccount("2");

            Assert.AreEqual("2", reloadAccount.Data.AccountNumber);
            Assert.AreEqual("Bob", reloadAccount.Data.FirstName);
            Assert.AreEqual(223.00M, reloadAccount.Data.Balance);
        }
        public void CanWithdrawMoney()
        {
            var ops = new AccountOperations();
            var loadAccountResponse = ops.GetAccount("2");
            var request = new WithDrawalRequest();
            request.Account = loadAccountResponse.Data;
            request.WithdrawalAmount = 100.00M;
            var withdrawalRequest = ops.MakeWithDrawal(request);

            var reloadAccount = ops.GetAccount("2");

            Assert.AreEqual("2", reloadAccount.Data.AccountNumber);
            Assert.AreEqual("Bob", reloadAccount.Data.FirstName);
            Assert.AreEqual(23.00M, reloadAccount.Data.Balance);
        }
 public void NotFoundAccountReturnsFail()
 {
     var operations = new AccountOperations();
     var response = operations.GetAccount("10000");
     Assert.IsFalse(response.Success);
     Assert.AreEqual("Account Not Found!", response.Message);
 }
        private Account ConverNumberToAccount(string accountNumber)
        {
            var ops = new AccountOperations();
            var response = ops.GetAccount(accountNumber);
            Console.Clear();

                _currentAccount = response.Data;
                return _currentAccount;
        }
        public void FoundAccountReturnsSuccess()
        {
            var operations = new AccountOperations();
            var response = operations.GetAccount("1");

            Assert.IsTrue(response.Success);
            Assert.AreEqual("1", response.Data.AccountNumber);
            Assert.AreEqual("Mary", response.Data.FirstName);
            Assert.AreEqual("Jones", response.Data.LastName);
            Assert.AreEqual(327.00M, response.Data.Balance);
        }
Exemple #6
0
        public void DisplayAccountInformation(int AccountNumber)
        {
            var ops = new AccountOperations();
            var response = ops.GetAccount(AccountNumber);

            if (response.Success)
            {
                PrintAccountInformation(response.AccountInfo);

            }
            else
            {
                Console.WriteLine("Error Occurred!!!");
                Console.WriteLine(response.Message);
                Console.Write("Move along...");
                Console.ReadLine();
            }
        }
        public void Execute(Account account)
        {
            // get transfer amount
            decimal transferAmount = GetTransferAmount(account);
            var ops = new AccountOperations();

            //withdraw transfer amount from that account
            var fromAccountRequest = new WithDrawalRequest()
            {
                Account = account,
                WithdrawalAmount = transferAmount
            };
            var fromAccountResponse = ops.MakeWithDrawal(fromAccountRequest);

            string getTransferAccount = GetTransferAccount();

            //trying to assign the transferTo account as the account in the deposit request.
            //have to change string toAccount to Account
            var getAccountResponse = ops.GetAccount(getTransferAccount);
            var toAccount = getAccountResponse.Data;

            var toAccountRequest = new DepositRequest()
            {
                Account = toAccount,
                DepositAmount = transferAmount
            };

            var toAccountResponse = ops.MakeDeposit(toAccountRequest);

            if (getAccountResponse.Success)
            {
                Console.Clear();
                Console.WriteLine("Transfered from account {0}, New Balance: {1:C}", fromAccountResponse.Data.AccountNumber, toAccountResponse.Data.Balance);
                UserInteractions.PressKeyToContinue();
            }
            else
            {
                Console.Clear();
                Console.WriteLine("An Error Occured:  {0}", fromAccountResponse.Message);
                UserInteractions.PressKeyToContinue();
            }
        }
Exemple #8
0
        private void DisplayAccountInformation(string accountNumber)
        {
            var ops = new AccountOperations();
            var response = ops.GetAccount(accountNumber);
            Console.Clear();

            if (response.Success)
            {
                _currentAccount = response.Data;
                PrintAccountDetails(response);
                DisplayActionMenu();
                UserInteractions.PressKeyToContinue();
            }
            else
            {
                Console.WriteLine("A problem occured...");
                Console.WriteLine(response.Message);

                UserInteractions.PressKeyToContinue();
            }
        }
Exemple #9
0
        public bool DisplayTargetAccountInfo(int AccountNumber)
        {
            var ops = new AccountOperations();
            var response = ops.GetAccount(AccountNumber);

            if (response.Success)
            {
                _targetAccount = response.AccountInfo;
                Console.WriteLine("We will be transfering money to {0} {1} with Account Number {2} and a current balance of {3}.", _targetAccount.FirstName, _targetAccount.LastName, _targetAccount.AccountNumber, _targetAccount.Balance);
                Console.WriteLine("Press Enter to continue...");
                Console.ReadLine();
                return true;
            }
            else
            {
                Console.WriteLine("Error Occurred!!");
                Console.WriteLine("This account does not exist.");
                Console.WriteLine("Press Enter to continue...");
                Console.ReadLine();
                return false;
            }
        }
Exemple #10
0
        public void DisplayAccountInformation(int AccountNumber)
        {
            var ops = new AccountOperations();
            var response = ops.GetAccount(AccountNumber);

            if (response.Success)
            {
                _currentAccount = response.AccountInfo;

                PrintAccountInformation(response.AccountInfo);
                Console.ReadLine();

                DisplayAccountMenu();

            }
            else
            {
                Console.WriteLine("Error Occurred!!!");
                Console.WriteLine(response.Message);
                Console.WriteLine("Press Enter to continue...");
                Console.ReadLine();

            }
        }
 public void Execute(int accountNumber)
 {
     var ops = new AccountOperations();
     var response = ops.GetAccount(accountNumber);
     PromptForWithdrawalAmount(response.AccountInfo);
 }
 public void CanTransferMoney()
 {
     var ops = new AccountOperations();
     var accountFrom = ops.GetAccount("1");
     var accountTo = ops.GetAccount("2");
 }