public void Execute()
        {
            //load the Account Manager to lookup the data
            //Ask the Factory to fetch us an Account Manager object.
            AccountManager manager = Factory.Create();

            Console.Clear();
            Console.WriteLine("Lookup an account");
            Console.WriteLine("-----------------------------------------------");

            Console.Write("enter an account number: ");
            string accountNum = Console.ReadLine();

            AcctLookupResponse response = manager.LookupAcct(accountNum);

            if (response.Success)
            {
                ConsoleIO.DisplayAccountDetails(response.Account);
            }
            else
            {
                Console.WriteLine("an error occurred: ");
                Console.WriteLine(response.Message);
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
Example #2
0
        public void CanLoadFreeAcctTestData()
        {
            AccountManager     manager = Factory.Create();
            AcctLookupResponse resp    = manager.LookupAcct("");

            Assert.IsNotNull(resp.Account);
            Assert.IsTrue(resp.Success);
            Assert.AreEqual("12345", resp.Account.AccountNumber);
        }
Example #3
0
        public AcctLookupResponse LookupAcct(string acctNumber)
        {
            AcctLookupResponse response = new AcctLookupResponse();

            response.Account = _acctRepo.LoadAcct(acctNumber);
            if (response.Account == null)
            {
                response.Success = false;
                response.Message = $"{acctNumber} is not a valid account.";
            }
            else
            {
                response.Success = true;
            }
            return(response);
        }