Exemplo n.º 1
0
        internal BankAccountDetails GiveAccountDetails(SingleAccountInfo selectedAccountInfo)
        {
            WebRequestComms sComms = new WebRequestComms();
            CommunicationModule comms = new CommunicationModule(sComms);

            return comms.GiveAccountDetails(selectedAccountInfo);
        }
Exemplo n.º 2
0
        internal BankAccountDetails GiveAccountDetails(SingleAccountInfo selectedAccountInfo)
        {
            WebRequestComms     sComms = new WebRequestComms();
            CommunicationModule comms  = new CommunicationModule(sComms);

            return(comms.GiveAccountDetails(selectedAccountInfo));
        }
Exemplo n.º 3
0
        internal BankCommsCapsule ReadAccountInfo(SingleAccountInfo info)
        {
            BankCommsCapsule commsCapsule = new BankCommsCapsule(info.login, info.password);

            //TODO bank url creation
            return(commsCapsule);
        }
Exemplo n.º 4
0
        internal BankCommsCapsule CreateBankCommunicationsCapsule(SingleAccountInfo info)
        {
            ConfigReader configReader = new ConfigReader();

            BankCommsCapsule capsule = configReader.ReadAccountInfo(info);

            return(capsule);
        }
Exemplo n.º 5
0
        internal BankCommsCapsule CreateBankCommunicationsCapsule(SingleAccountInfo info)
        {
            ConfigReader configReader = new ConfigReader();

            BankCommsCapsule capsule = configReader.ReadAccountInfo(info);

            return capsule;
        }
Exemplo n.º 6
0
 internal void DisplayBankAccounts(SingleAccountInfo bankInfo)
 {
     try
     {
         Console.WriteLine("Your bank: {0}", bankInfo.bankName);
         Console.WriteLine("Your account: {0}\n", bankInfo.accountType);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 7
0
        public BankAccountDetails GiveAccountDetails(SingleAccountInfo info)
        {
            AccountInfoRequestFactory factory = new AccountInfoRequestFactory();
            BankCommsCapsule capsule = factory.CreateBankCommunicationsCapsule(info);

            CommunicationsResponse resp = _selectedComms.RetrieveSelectedBankAccountDetails(capsule);//the part where magic happens

            AccountInfoResponseParser parser = new AccountInfoResponseParser();
            BankAccountDetails details = parser.FormAccountDetails(resp);

            return details;
        }
Exemplo n.º 8
0
        public BankAccountDetails GiveAccountDetails(SingleAccountInfo info)
        {
            AccountInfoRequestFactory factory = new AccountInfoRequestFactory();
            BankCommsCapsule          capsule = factory.CreateBankCommunicationsCapsule(info);

            CommunicationsResponse resp = _selectedComms.RetrieveSelectedBankAccountDetails(capsule);//the part where magic happens

            AccountInfoResponseParser parser  = new AccountInfoResponseParser();
            BankAccountDetails        details = parser.FormAccountDetails(resp);

            return(details);
        }
Exemplo n.º 9
0
        public SingleAccountInfo ChooseAccount(string selectedAccount, SingleAccountInfo[] allBanksInfo)
        {
            SingleAccountInfo selectedAccountInfo = new SingleAccountInfo();

            foreach (var bankInfo in allBanksInfo)
            {
                if (bankInfo.bankName == selectedAccount)
                    selectedAccountInfo = bankInfo;
            }

            Console.WriteLine("Chosen account: {0}", selectedAccountInfo.bankName);
            return selectedAccountInfo;
        }
Exemplo n.º 10
0
        public void GiveAccountDetailsDoesAnythingAtAll()
        {
            //Given
            SingleAccountInfo fakeAccountInfo = new SingleAccountInfo();

            IRequestComms selectedComms = new MockRequestComms(fakeAccountInfo);

            CommunicationModule moduleUnderTest = new CommunicationModule(selectedComms);

            //When
            BankAccountDetails result = moduleUnderTest.GiveAccountDetails(fakeAccountInfo);

            //Then
            Assert.IsTrue(result != null);
        }
Exemplo n.º 11
0
        public SingleAccountInfo ChooseAccount(string selectedAccount, SingleAccountInfo[] allBanksInfo)
        {
            SingleAccountInfo selectedAccountInfo = new SingleAccountInfo();

            foreach (var bankInfo in allBanksInfo)
            {
                if (bankInfo.bankName == selectedAccount)
                {
                    selectedAccountInfo = bankInfo;
                }
            }

            Console.WriteLine("Chosen account: {0}", selectedAccountInfo.bankName);
            return(selectedAccountInfo);
        }
Exemplo n.º 12
0
        public void GiveAccountDetailsDoesAnythingAtAll()
        {
            //Given
            SingleAccountInfo fakeAccountInfo = new SingleAccountInfo();

            IRequestComms selectedComms = new MockRequestComms(fakeAccountInfo);

            CommunicationModule moduleUnderTest = new CommunicationModule(selectedComms);

            //When
            BankAccountDetails result = moduleUnderTest.GiveAccountDetails(fakeAccountInfo);

            //Then
            Assert.IsTrue(result != null);
        }
Exemplo n.º 13
0
        public void Initialise()
        {
            AccountManager accountManager = new AccountManager();

            allBanksInfo = accountManager.AllBankAccounts();

            foreach (var bankInfo in allBanksInfo)
            {
                uiDisp.DisplayBankAccounts(bankInfo);
            }

            string            selectedAccount = uiDisp.ChooseAccount();
            SingleAccountInfo chosenAccount   = accountManager.ChooseAccount(selectedAccount, allBanksInfo);

            accountManager.GiveAccountDetails(chosenAccount);
        }
Exemplo n.º 14
0
 internal BankCommsCapsule ReadAccountInfo(SingleAccountInfo info)
 {
     BankCommsCapsule commsCapsule = new BankCommsCapsule(info.login, info.password);
     //TODO bank url creation
     return commsCapsule;
 }
Exemplo n.º 15
0
 public MockRequestComms(SingleAccountInfo fakeInfo)
 {
     _fakeInfo = fakeInfo;
 }
Exemplo n.º 16
0
 public MockRequestComms(SingleAccountInfo fakeInfo)
 {
     _fakeInfo = fakeInfo;
 }