public void ATC_TopUpTestDatab()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "TopUp_TestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickCompanyButton();

            SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
            Table table = new Table(selectCompanyPage.GetCompanyListTable());
            table.ClickCellValue("Company", "RTB", "Company");
            selectCompanyPage.ClickOkButton();

            homePage.ClickHomeTab();
            homePage.ClickCashandBankManagementTab();
            homePage.ClickBankStatementsLink();

            homePage.ClickImportStatementButton();
            BAI2FileImportPage bai2FileImportPage = new BAI2FileImportPage();
            bai2FileImportPage.SetStatmentFormatText("CBA BAI2");
            bai2FileImportPage.SetImportFileFolderCheckBox(false);
            bai2FileImportPage.SetFileNamelocationText(filelocation);
            bai2FileImportPage.SetReconcileImportCheckBox(true);
            bai2FileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            string bvdTreeItem = infoLogPage.GetTreeItemName("Journal BDV","Posting");
            string BVD = bvdTreeItem.Substring(8, 9);

            Assert.IsTrue(infoLogPage.GetTreeItemExists("1 files have been imported in total.", "Posting"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();

            homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();

            //CRM Outbound Messages
            homePage.ClickSystemLink();
            homePage.ClickOutboundCRMMessagesLink();
            OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
            table = new Table(outboundCRMMessagePage.GetNotificationTable());
            table.FilterCellValue("Payment reference");
            outboundCRMMessagePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Payment reference", paymentreference);
            filterPage.ClickOkButton();
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value = table.GetCellValue("Payment reference", paymentreference, "Bond");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC7120b_AXAC1Fileformatverification()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "7120")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
            string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink();

            BPayFilePage bpayFile = new BPayFilePage();
            bpayFile.ClickImportMenuItem();

            BPayFileImportPage bpayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bpayFileImportPage.GetWindowExistStatus());
            bpayFileImportPage.SetMoveFileCheckBox(true);

            bpayFileImportPage.SetProcessFileCheckBox(true);
            bpayFileImportPage.SetImportPathText("");
            bpayFileImportPage.SetFileNameEdit(filelocation);
            bpayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            //check that file imported successful
            //Assert.IsTrue(infoLogPage.GetTreeItemNOTExists("Cannot create a record in", "Importing BPAY file"));
            Assert.IsTrue(infoLogPage.GetTreeItemExists("Posting journal BDV", "Importing BPAY file"));
            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bpayFile.ClickCloseButton();

            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
            outboundCRMIntegrationPage.ClickOKButton();

            //CRM Outbound Messages
            homePage.ClickSystemLink();
            homePage.ClickOutboundCRMMessagesLink();
            OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
            Table table = new Table(outboundCRMMessagePage.GetNotificationTable());
            table.FilterCellValue("Payment reference");
            outboundCRMMessagePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Payment reference", paymentreference);
            filterPage.ClickOkButton();

            StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Bond Balance"), initialContribution);

            ////Navigate to Payments/BPay file exceptions
            //homePage.ClickPaymentsLink();
            //homePage.ClickBPayFileExceptionLink();

            ////Order by created date

            ////Confirm customer referance number exists
            //BPayFileExceptionsPage bPayFileExceptionPage = new BPayFileExceptionsPage();

            //Table table = new Table(bPayFileExceptionPage.GetFileExceptionTable());

            //table.FilterCellValue("Customer reference number");

            //bPayFileExceptionPage.ClickFilterMenuItem();

            //FilterPage filterPage = new FilterPage();
            //filterPage.SetCustomerReferenceNumberText(paymentreference);
            //filterPage.ClickOkButton();

            //StringAssert.Contains(table.GetCellValue("Customer reference number", paymentreference, "Rejection reason"), "Invalid CRN");
            //bPayFileExceptionPage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC7125b_AXTESTINGEndtoEndSingleFormBPayAXSuccess()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "7125")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string referenceNumber = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
            string tenancyrequest = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string fileLocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();

            Homepage homePage = new Homepage();
            homePage.ClickHomeTab();
            homePage.ClickBondManagementTab();
            homePage.ClickPaymentsLink();
            homePage.ClickBPayFileLink();

            BPayFilePage bpayFile = new BPayFilePage();
            bpayFile.ClickImportMenuItem();

            BPayFileImportPage bpayFileImportPage = new BPayFileImportPage();
            Assert.IsTrue(bpayFileImportPage.GetWindowExistStatus());
            bpayFileImportPage.SetMoveFileCheckBox(true);

            bpayFileImportPage.SetProcessFileCheckBox(true);

            bpayFileImportPage.SetImportPathText("");
            bpayFileImportPage.SetFileNameEdit(fileLocation);
            bpayFileImportPage.ClickOKButton();

            InfoLogPage infoLogPage = new InfoLogPage();
            //check that file imported successful
            Assert.IsTrue(infoLogPage.GetTreeItemNOTExists("Cannot create a record in", "Importing BPAY file"));

            string rtbTreeItem = infoLogPage.GetTreeItemName("Processing BPAY file RTB-", "Importing BPAY file");
            string RTB = rtbTreeItem.Substring(21, 10);
            string bvdTreeItem = infoLogPage.GetTreeItemName("Posting journal BDV", "Importing BPAY file");
            string BVD = bvdTreeItem.Substring(16, 9);
            //Assert.IsTrue(infoLogPage.GetTreeItemExists("1 file(s) were processed","Importing BPAY file"));

            infoLogPage.ClickClearButton();
            infoLogPage.ClickCloseButton();
            bpayFile.ClickCloseButton();

            homePage.ClickCRMOutboundNotificationsLink();
            OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
            outboundCRMIntegrationPage.ClickOKButton();

            //CRM Outbound Messages
            homePage.ClickSystemLink();
            homePage.ClickOutboundCRMMessagesLink();
            OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
            Table table = new Table(outboundCRMMessagePage.GetNotificationTable());
            table.FilterCellValue("Payment reference");
            outboundCRMMessagePage.ClickFilterMenuItem();
            FilterPage filterPage = new FilterPage();
            filterPage.SetFilterText("Payment reference", referenceNumber);
            filterPage.ClickOkButton();

            StringAssert.Contains(table.GetCellValue("Payment reference", referenceNumber, "Bond request"), tenancyrequest);
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value = table.GetCellValue("Payment reference", referenceNumber, "Bond");

            outboundCRMMessagePage.ClickCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6904b_AXTopupExcessBondValidation()
        {
            #region Start Up Excel
             MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\TenancyRequests.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
             MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
             MyRange = MySheet.UsedRange;

             //Get specific row for the data
             int testDataRows = MyRange.Rows.Count;
             int MyRow = 0;
             for (int i = 2; i <= testDataRows; i++)
             {
                 if (MyRange.Cells[i, 1].Value.ToString() == "Topup_6904")
                 {
                     MyRow = i;
                     break;
                 }
             }
             #endregion

             string filelocation = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value.ToString();
             string paymentreference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value.ToString();
             string tenancyRequestReference = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
             string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
             string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

             Homepage homePage = new Homepage();

             homePage.ClickCompanyButton();
             SelectCompanyPage selectCompanyPage = new SelectCompanyPage();
             Table table = new Table(selectCompanyPage.GetCompanyListTable());
             table.ClickCellValue("Company", "RTB", "Company");
             selectCompanyPage.ClickOkButton();

             homePage.ClickHomeTab();
             homePage.ClickBondManagementTab();
             homePage.ClickPaymentsLink();
             homePage.ClickBPayFileLink();

             BPayFilePage bpayFile = new BPayFilePage();
             bpayFile.ClickImportMenuItem();

             BPayFileImportPage bpayFileImportPage = new BPayFileImportPage();
             Assert.IsTrue(bpayFileImportPage.GetWindowExistStatus());
             bpayFileImportPage.SetMoveFileCheckBox(true);

             bpayFileImportPage.SetProcessFileCheckBox(true);
             bpayFileImportPage.SetImportPathText("");
             bpayFileImportPage.SetFileNameEdit(filelocation);
             bpayFileImportPage.ClickOKButton();

             InfoLogPage infoLogPage = new InfoLogPage();
             //check that file imported successful
             Assert.IsTrue(infoLogPage.GetTreeItemExists("File imported with identifier", "Importing BPAY file"));

             infoLogPage.ClickClearButton();
             infoLogPage.ClickCloseButton();
             bpayFile.ClickCloseButton();

             homePage.ClickCRMOutboundNotificationsLink();
             OutboundCRMIntegrationPage outboundCRMIntegrationPage = new OutboundCRMIntegrationPage();
             outboundCRMIntegrationPage.ClickOKButton();

             //CRM Outbound Messages
             homePage.ClickSystemLink();
             homePage.ClickOutboundCRMMessagesLink();
             OutboundCRMMessagePage outboundCRMMessagePage = new OutboundCRMMessagePage();
             table = new Table(outboundCRMMessagePage.GetNotificationTable());
             table.FilterCellValue("Payment reference");
             outboundCRMMessagePage.ClickFilterMenuItem();
             FilterPage filterPage = new FilterPage();
             filterPage.SetFilterText("Payment reference", paymentreference);
             filterPage.ClickOkButton();

             StringAssert.Contains(table.GetCellValue("Payment reference", paymentreference, "Bond Balance"), initialContribution);
             MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value = table.GetCellValue("Payment reference", paymentreference, "Bond");

             #region Shut down Excel
             MyBook.Save();
             MyBook.Close();
             MyApp.Quit();
             #endregion
        }