public void ATC9875_CRMTenancyRequestBLManagementTypeIsMandatory()
        {
            //Login as RBS Operations Standard User Role.
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: RBS group > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            //To finish when I find out where new is on the page - GD
        }
        public void ATC9204_CRMInputDataToRefundRequestsAC1InputAdditionalData()
        {
            //Login as RBS Operations Standard User Role.
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: RBS group > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            //Set view to Active Bond Refunds.
            tenancyRequestSearchPage.SetPageFilterList("Active Bond Refunds");

            //Double-click on record to open it.
            UICommon.DoubleClickElement(tenancyRequestSearchPage.GetSearchResultRow(), driver);

            //Ensure following fields are editable and mandatory i.e. Ensure cannot save record when cleared:
            //Assert: This field is Mandatory - Amount to be refunded per contributor (M)

            /*
             * Ensure following fields are editable and optional and requirements are reflected in software:
                - Date Tenants/residents vacated (O)
                - Expiry date of notice (O)
                - Forwarding address of every contributor (O)
                - date signed by every contributor and the managing party (O)
                - Details of Claim with Amounts (O, Claim reason list - see Picture+free text - 300 (?)
                +)
                Amounts are optional, a CRM user should be able to choose multiple reasons associated with the full amount of claim
             */

            //Modify Address and dollar values fields.

            //Select the [AUDIT HISTORY] item from the entity navigation menu in the global ribbon.

            //Inspect audit history.
        }
        public void ATC4414_CRMRoomingAccommodationneedstodefaultto1bedroom()
        {
            #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() == "4414")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            //tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy("1 THOMAS ST, BIRKDALE, QLD, 4159", "Residential Tenancy", "AMANDA TEST", "3", "AARON BALL", "700", "700", "Initial");
            tenancyRequestPage.PopulateTenancyRequestFormRoomingAccomodation(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();

            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(),"1");

            ////Change Tenancy type
               tenancyRequestPage.SetResidentialTenancyTypeList("Residential Tenancy");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(), "--");

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            tenancyRequestPage.ClickSaveCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6708_CRMDistributeAmountForContributors()
        {
            #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() == "6708")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string secondContributor = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC1")].Value.ToString();
            string thridContributor = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC2")].Value.ToString();

            //Login as RBS Operations Standard user role.
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            //Create new Tenancy Request with mandatory fields populated
            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            string initialRequestParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

             tenancyRequestPage.PopulateMandatoryFieldValues(
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
              initialRequestParty,
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
              initialContribution,
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            //Save Tenancy Record
            tenancyRequestPage.ClickSaveButton();
            string tenancyRequest = tenancyRequestPage.GetRequestNumber();

            //Inspect Screen for Warnings "Warning displays that {Amount Paid with Lodgement} field <> sum of contributors."
            string warningMessage = tenancyRequestPage.GetWarningMessage();
            StringAssert.Contains(warningMessage, "Sum of Request does not equal the amount entered for Amount Paid with Lodgement","Validating the warning appears");

            //Click the ribbon button Distribute and Save the record. Warnings should disappear
            string alertMessage = tenancyRequestPage.ClickDistributeButton();
            StringAssert.Contains(alertMessage, "Distribution process has been initiated");

            //TODO:This is an issue an extra save dialog pops up and clicking OK button on this.
            string saveMessage = tenancyRequestPage.GetAlertMessage();
            StringAssert.Contains(saveMessage, "Your changes have not been saved");

            warningMessage = tenancyRequestPage.GetWarningMessage();
            Assert.AreEqual(warningMessage, "","Validating that warning message disappeared");

            //Add another contributor and populate amount field with > $1. Save Record. Warning should appear.
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            tenancyRequestPage.ClickAddNewRequestPartyImage();
            Thread.Sleep(2000);

            driver = tenancyRequestPage.SwitchNewBrowser(driver, BaseWindow);

            TenancyRequestPartyPage tenancyRequestPartyPage = new TenancyRequestPartyPage(driver);
            tenancyRequestPartyPage.ClickPageTitle();
            tenancyRequestPartyPage.SetClientNameValue(secondContributor);
            tenancyRequestPartyPage.SetAmountValue("100");
            tenancyRequestPartyPage.ClickSaveCloseButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickSaveButton();

               //TODO:Issue the waning does not appear without refreshing the record.This is a workaround.
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "New");

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Inspect warning appears
            warningMessage = tenancyRequestPage.GetWarningMessage();
            StringAssert.Contains(warningMessage, "Sum of Request does not equal the amount entered for Amount Paid with Lodgement","Validating that the warning appears");

            //Add another contributor and populate amount field with > $1. Save Record. Warning should appear.
            BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            tenancyRequestPage.ClickAddNewRequestPartyImage();
            Thread.Sleep(2000);
            driver = tenancyRequestPage.SwitchNewBrowser(driver, BaseWindow);

            tenancyRequestPartyPage = new TenancyRequestPartyPage(driver);
            tenancyRequestPartyPage.ClickPageTitle();
            tenancyRequestPartyPage.SetClientNameValue(thridContributor);
            tenancyRequestPartyPage.SetAmountValue("100");
            tenancyRequestPartyPage.ClickSaveCloseButton();

            driver = driver.SwitchTo().Window(BaseWindow);
            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickSaveButton();

            //Inspect warning appears
            warningMessage = tenancyRequestPage.GetWarningMessage();
            StringAssert.Contains(warningMessage, "Sum of Request does not equal the amount entered for Amount Paid with Lodgement","Validating that the warning appears");

            //Click the ribbon button Distribute and Save the record. Warning should disappear.
            alertMessage = tenancyRequestPage.ClickDistributeButton();
            StringAssert.Contains(alertMessage, "Distribution process has been initiated");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickSaveButton();

            //Issue the waning does disappear not appear without refreshing the record.This is a workaround.
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "New");

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Warning disappears
            warningMessage = tenancyRequestPage.GetWarningMessage();
            Assert.AreEqual(warningMessage, "", "Validating that warning message disappeared");

            //Modify amount paid with lodgemnt to $1500 and inspect warning appears
            tenancyRequestPage.SetAmountPaidWithLodgement("1500");
            tenancyRequestPage.ClickSaveButton();

            warningMessage = tenancyRequestPage.GetWarningMessage();
            StringAssert.Contains(warningMessage, "Sum of Request does not equal the amount entered for Amount Paid with Lodgement","Validating that the warning appears");

            //TODO:Modify Contibutor amount to be different but still adds up to amount. Inspect warning disappears
            Table requestPartyTable = new Table(tenancyRequestPage.GetRequestPartyTable());
            StringAssert.Contains(requestPartyTable.GetCellContainsValue("Client", secondContributor, "Request Amount"), "400");

            BaseWindow = driver.CurrentWindowHandle;
            UICommon.DoubleClickElement(requestPartyTable.GetCellElementContainsValue("Client", secondContributor, "Client"), driver);
            Thread.Sleep(1000);

            driver = tenancyRequestPage.SwitchNewBrowser(driver, BaseWindow);

            tenancyRequestPartyPage = new TenancyRequestPartyPage(driver);
            tenancyRequestPartyPage.ClickPageTitle();

            tenancyRequestPartyPage.SetAmountValue("700");
            tenancyRequestPage.ClickSaveCloseButton();

            driver = driver.SwitchTo().Window(BaseWindow);

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickSaveButton();

            //TODO.WArnings does not disappear without refreshing the record. This is a workaround.
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "New");

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Warning disappears
            warningMessage = tenancyRequestPage.GetWarningMessage();
            Assert.AreEqual(warningMessage, "", "Validating that warning message disappeared");

            //Modify amount paid with lodgement to be $900
            tenancyRequestPage.SetAmountPaidWithLodgement("900");
            tenancyRequestPage.ClickSaveButton();

            //Warning appears
            warningMessage = tenancyRequestPage.GetWarningMessage();
            StringAssert.Contains(warningMessage, "Sum of Request does not equal the amount entered for Amount Paid with Lodgement","Validating that the warning appesrs");

            //Click Distribute and save the record. Warning should disappear
            tenancyRequestPage.ClickDistributeButton();
            tenancyRequestPage.ClickSaveButton();

            warningMessage = tenancyRequestPage.GetWarningMessage();
            Assert.AreEqual(warningMessage, "", "Validating that warning message disappeared");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4412_CRMCheckTenancyRequestID()
        {
            #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() == "4412")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();

            string caseId1 = tenancyRequestPage.GetRequestNumber();
            int caseNum1 = int.Parse(caseId1.Substring(6));

            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();

            string caseId2 = tenancyRequestPage.GetRequestNumber();
            int caseNum2 = int.Parse(caseId2.Substring(6));

             //checks if Investigation case starts with "TR-BL-"
            StringAssert.Contains(caseId1,"TR-BL-");
            StringAssert.Contains(caseId2,"TR-BL-");
            Assert.AreEqual(caseNum1, caseNum2 - 1);      //if caseNum2 is a single increment from caseNum1 then TRUE

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6837d_CRMCancelBPayRequestBatchWithTopup()
        {
            #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;

            /*Data preparation:
            Request batch is required with the following:

            - Several TRs (Type = Bond Lodgment) under it, including initial lodgement and at least one top-up (i.e. linked to existing Bond Number via {Tenancy} field, must have same managing party / contributors / tenancy address)

            - RB and TR all have {Payment Type} = BPay
            - RB has been successfully validated i.e. RB and TRs have {Status Reason} = Pending financials; are read only (bar bug 6343)
            - RB BPay reference is generated for total amount of all TRs*/

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

            string initialtenancyrequest = MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();

            int tRow2 = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "Topup_6837")
                {
                    tRow2 = i;
                    break;
                }
            }
            string topuptenancyrequest = MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);

            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();

            homePage.ClickRequestBatchRibbonButton();

            RequestBatchesSearchPage requestBatchSearchPage = new RequestBatchesSearchPage(driver);
            requestBatchSearchPage.ClickNewRequestBatchButton();

            RequestBatchPage requestBatchPage = new RequestBatchPage(driver);
            requestBatchPage.ClickPageTitle();
            requestBatchPage.SetManagingPartyText(MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString());
            requestBatchPage.SetPaymentType(MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());
            requestBatchPage.ClickSaveButton();
            string requestBatch = requestBatchPage.GetRequestNumber();

            StringAssert.Contains(requestBatch, "TRB-BL-");

            requestBatchPage.ClickAddAssociatedRequestsButton();
            requestBatchPage.SetAssociatedRequest(initialtenancyrequest);

            requestBatchPage.ClickSaveCloseButton();

            requestBatchSearchPage = new RequestBatchesSearchPage(driver);

            requestBatchSearchPage.SetRequestBatchSearchText(requestBatch);
            Table reqBatchTable = new Table(requestBatchSearchPage.GetSearchResultTable());
            reqBatchTable.ClickCellValue("Name", requestBatch, "Name");

            requestBatchPage = new RequestBatchPage(driver);
            requestBatchPage.ClickAddAssociatedRequestsButton();
            requestBatchPage.SetAssociatedRequest(topuptenancyrequest);

            requestBatchPage.ClickSaveButton();
            requestBatchPage.SetStatusReason("Ready for validation");

            requestBatchPage.ClickSaveCloseButton();

            requestBatchSearchPage = new RequestBatchesSearchPage(driver);
            Assert.IsTrue(requestBatchSearchPage.GetPaymentRefernceRefreshTable(requestBatch));
            requestBatchSearchPage.SetRequestBatchSearchText(requestBatch);
            Table requestBatchTable = new Table(requestBatchSearchPage.GetSearchResultTable());
            requestBatchTable.ClickCellValue("Name", requestBatch, "Name");

            requestBatchPage = new RequestBatchPage(driver);
            requestBatchPage.ClickPageTitle();
            Assert.AreEqual(requestBatchPage.GetSumBondamountPaid(), "$2,050.00");

            requestBatchTable = new Table(requestBatchPage.GetPaymentSummaryResultTable());

            StringAssert.Contains(requestBatchTable.GetCellValue("Request Batch", requestBatch, "Request Batch"), requestBatch,"Validate the payment ref record in req batch");
            StringAssert.Contains(requestBatchTable.GetCellValue("Request Batch", requestBatch, "Payment Type"), "BPay","Validate the payment ref record in req batch");
            StringAssert.Contains(requestBatchTable.GetCellValue("Request Batch", requestBatch, "Amount"), "$2,050.00","Validate the payment ref record in req batch");
            StringAssert.Contains(requestBatchTable.GetCellValue("Request Batch", requestBatch, "Client"), MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),"Validate the payment ref record in req batch");

            string reqbatreferencenumber = requestBatchTable.GetCellValue("Request Batch", requestBatch, "Reference Number");

            Thread.Sleep(5000);

            Assert.AreEqual(requestBatchPage.GetStatusReason(), "Pending Financials","Validate the status reason of req batch:"+requestBatch);
            Assert.AreEqual(requestBatchPage.GetFundedStatus(), "Payment pending","Validate the processing status of req batch:"+requestBatch);
            Assert.AreEqual(requestBatchPage.GetRecordStatus(), "Read only","Validate the record status of req bact:"+requestBatch);

            Table tenancyReqTable = new Table(requestBatchPage.GetTenancyRequestTable());
            tenancyReqTable.ClickCellValue("Name", initialtenancyrequest, "Name");

            TenancyRequestPage tenancyReqPage = new TenancyRequestPage(driver);
            tenancyReqPage.ClickPageTitle();
            Assert.AreEqual(tenancyReqPage.GetStatusReason(), "Pending Financials", "Validating the status reason of TR" + initialtenancyrequest);
            Assert.AreEqual(tenancyReqPage.GetRecordStatus(), "Read only","Validating the record status of TR:"+initialtenancyrequest);

            homePage.HoverRBSRibbonTab();
            homePage.ClickRequestBatchRibbonButton();
            requestBatchSearchPage = new RequestBatchesSearchPage(driver);
            requestBatchSearchPage.SetRequestBatchSearchText(requestBatch);
            reqBatchTable = new Table(requestBatchSearchPage.GetSearchResultTable());
            reqBatchTable.ClickCellValue("Name", requestBatch, "Name");

            requestBatchPage = new RequestBatchPage(driver);

            tenancyReqTable = new Table(requestBatchPage.GetTenancyRequestTable());
            tenancyReqTable.ClickCellValue("Name", topuptenancyrequest, "Name");

            tenancyReqPage = new TenancyRequestPage(driver);
            tenancyReqPage.ClickPageTitle();
            Assert.AreEqual(requestBatchPage.GetStatusReason(), "Pending Financials", "Validating the status reason of TR" + topuptenancyrequest);
            Assert.AreEqual(tenancyReqPage.GetRecordStatus(), "Read only","Validating the record status of TR"+topuptenancyrequest);

            //Double-click on the BPay Payment Reference record under the Administration section.
            homePage.HoverRBSRibbonTab();
            homePage.ClickRequestBatchRibbonButton();
            requestBatchSearchPage = new RequestBatchesSearchPage(driver);
            requestBatchSearchPage.SetRequestBatchSearchText(requestBatch);
            reqBatchTable = new Table(requestBatchSearchPage.GetSearchResultTable());
            reqBatchTable.ClickCellValue("Name", requestBatch, "Name");

            requestBatchPage = new RequestBatchPage(driver);
            requestBatchTable = new Table(requestBatchPage.GetPaymentSummaryResultTable());
            IWebElement elem = requestBatchTable.GetCellElementContainsValue("Request Batch", requestBatch, "Reference Number");
            UICommon.DoubleClickElement(elem, driver);

            //Click the [Deactivate] button.Record is deactivated.
            PaymentReferncePage payRefPage = new PaymentReferncePage(driver);
            payRefPage.ClickDeactivateButton();

            WarningDialogueFramePage warnPage = new WarningDialogueFramePage(driver);
            warnPage.ClickProcessBeginButton();
            Thread.Sleep(3000);

            payRefPage = new PaymentReferncePage(driver);
            payRefPage.ClickPageTitle();
            Assert.AreEqual("Inactive", payRefPage.GetInactiveStatusFooter(),"Validate whether payment record of req batch:"+requestBatch+",is inactive after deactivating the record");

            //Inspect Batch Request record.
            homePage.HoverRBSRibbonTab();
            homePage.ClickRequestBatchRibbonButton();
            requestBatchSearchPage = new RequestBatchesSearchPage(driver);
            requestBatchSearchPage.SetRequestBatchSearchText(requestBatch);
            reqBatchTable = new Table(requestBatchSearchPage.GetSearchResultTable());
            reqBatchTable.ClickCellValue("Name", requestBatch, "Name");

            /*Record is active again, editable.
            {Status Reason} = New.
            Processing Status is blank.*/

            requestBatchPage = new RequestBatchPage(driver);
            requestBatchPage.ClickPageTitle();

            Assert.AreEqual(requestBatchPage.GetStatusReason(), "New","Validating the status reason is New for req batch:"+requestBatch);
            Assert.AreEqual(requestBatchPage.GetFundedStatus(), "--","Validating the processing status is blank for req batch:"+requestBatch);

            try
            {
                requestBatchPage.SetPaymentType("BPay");
            }
            catch (Exception)
            {
                new AssertFailedException("Payment Type in Req batch not editable after deactivating the payment ref record:" + requestBatch);
            }

            //Inspect all child Tenancy Request records.
            tenancyReqTable = new Table(requestBatchPage.GetTenancyRequestTable());
            tenancyReqTable.ClickCellValue("Name", initialtenancyrequest, "Name");

            /*Records are active again, editable.
            {Status Reason} = New.
            Processing Status is blank.*/
            tenancyReqPage = new TenancyRequestPage(driver);

            StringAssert.Contains(tenancyReqPage.GetStatusReason(), "New", "Validating the status reason is New for TR" + initialtenancyrequest);
            StringAssert.Contains(tenancyReqPage.GetFundedStatus(), "","Validating the processing status is blank for TR"+initialtenancyrequest);
            try
            {
                tenancyReqPage.SetRequestTypeListValue("Bond Lodgement");
            }
            catch (Exception)
            {
                new AssertFailedException("Request Type in Child Tenacy Req" + initialtenancyrequest + " not editable after deactivating the payment ref record in req batch:" + requestBatch);
            }

            homePage.HoverRBSRibbonTab();
            homePage.ClickRequestBatchRibbonButton();
            requestBatchSearchPage = new RequestBatchesSearchPage(driver);
            requestBatchSearchPage.SetRequestBatchSearchText(requestBatch);

            reqBatchTable = new Table(requestBatchSearchPage.GetSearchResultTable());
            reqBatchTable.ClickCellValue("Name", requestBatch, "Name");

            requestBatchPage = new RequestBatchPage(driver);

            tenancyReqTable = new Table(requestBatchPage.GetTenancyRequestTable());
            tenancyReqTable.ClickCellValue("Name", topuptenancyrequest, "Name");

            tenancyReqPage = new TenancyRequestPage(driver);

            StringAssert.Contains(tenancyReqPage.GetStatusReason(), "New", "Validating the status reason is New for TR:" + topuptenancyrequest);
            StringAssert.Contains(tenancyReqPage.GetFundedStatus(), "","Validating the processing status is blank for TR:" + topuptenancyrequest);
            try
            {
                tenancyReqPage.SetRequestTypeListValue("Bond Lodgement");
            }
            catch (Exception)
            {
                new AssertFailedException("Request Type in Child Tenacy Req" + topuptenancyrequest + " not editable after deactivating the payment ref record in req batch:" + requestBatch);
            }
        }
        public void ATC6904c_CRMTopupExcessBondValidation()
        {
            #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 managepingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();

            //Login as RBS user
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            //(Template) - Create new Tenancy Request (Bond Lodgement)
            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            /*Enter details.Details entered
            - Tenancy (prepared Tenancy)
            - Rooming Accommodation
            - Rent subsidy
            - rent $200
            - amount paId $701*/
            tenancyRequestPage.SetRequestTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString());
            tenancyRequestPage.SetRentalPremisesValue("*"+MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString());
            tenancyRequestPage.SetManagingPartyListValue(managepingParty);
            tenancyRequestPage.SetTenancyTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString());
            tenancyRequestPage.SetTenancyManagementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString());
            tenancyRequestPage.SetInitialRequestPartyWithSearch(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString());
            tenancyRequestPage.SetInitialConrtibution("701");
            tenancyRequestPage.SetAmountPaidWithLodgement("701");
            tenancyRequestPage.SetLodgementTypeListValue("Top up");

            tenancyRequestPage.SetWeeklyRent(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString());
            tenancyRequestPage.SetTenancyStartDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString());
            tenancyRequestPage.SetAnticipatedEndDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString());
            tenancyRequestPage.SetPaymentType(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());
            tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString());

            tenancyRequestPage.SetSubsidy("Yes");

            tenancyRequestPage.SetTenancyValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value.ToString());

            //Save Tenancy Request
            tenancyRequestPage.ClickSaveButton();

            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            //Update Status Reason to 'Ready for validation'
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyrequest);
            Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Name", tenancyrequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Confirm Status Reason set to 'Validation failed'
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Validation failed");

            //Confirm Queue reason for excess bond added.Status set to 'To be resolved'
            //tenancyRequestPage.ClickQueueReasons();
            Table queueReasonTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueReasonTable.GetCellContainsValue("Reason", "Invalid bond amount : Exceeds maximum bond", "Status Reason"), "To be resolved");

            //Confirm Maximum Allowed Bond set correctly
            //Assert: Maximum Allowed Bond set to $2800
            Assert.AreEqual(tenancyRequestPage.GetMaximumAllowedAmount(), "$800.00");
        }
        public void ATC4483_CRMAutomaticallyrecordapaymentreferencenumberforthelodgement()
        {
            #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() == "TR_TestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            //string tenancyRequestReference;
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managingParty,
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest;

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyrequest);

            Assert.IsTrue(tenancyRequestSearchPage.GetPaymentRefernceRefreshTable(tenancyrequest));

            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            table.ClickCellValue("Name", tenancyrequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Payment pending");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6738_RaiseExceptionInvalidKeyword()
        {
            #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() == "6362")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string initialRequestParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();
            string rentalPremises = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString();

            //Login as RBS user
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            //(Template) - Create new Tenancy Request (Bond Lodgement)
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Set {Type} field to Bond Lodgement.
            tenancyRequestPage.SetRequestTypeListValue("Bond Lodgement");

            /*Select 'Australian Physical' as the Type.Enter an address into the fields on the Address Detail record. As part of the address that you enter, Type in the word 'Garage' into the 'Complex Unit Number' field
            Click on the Save & Close button*/
            string[] address = rentalPremises.Split(',');
            string complexunitno = address[0];
            string roadno = address[1].Split(' ')[1];
            string roadname = address[1].Split(' ')[2];
            string locality = address[2].Split(' ')[1] + "," + address[3] + "," + address[4];

            tenancyRequestPage.CreateNewAddress(roadno,roadname,locality,"","",complexunitno);
            tenancyRequestPage = new TenancyRequestPage(driver);

            //Select the mandatory fields for the Tenancy Request.Add a new Request Party whose contribution amount is the same as the Amount Paid with Lodgement
            tenancyRequestPage.PopulateTenancyRequestWithoutRentalPremisesFromAddressDetailAssociatedView(
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
              initialRequestParty,
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
              initialContribution,
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.SetDwellingTypeListValue("House");
            //Save the Tenancy Request
            tenancyRequestPage.ClickSaveButton();

            string tenancyrequest = tenancyRequestPage.GetRequestNumber();

            //Set the status of the Tenancy Request to be 'Ready for Validation'	Validation process for the Tenancy Request is started
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            Thread.Sleep(3000);

            //The status of the Tenancy Request should be set to Validation failed
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Validation failed");

            //Check the Queue Reasons of the Tenancy Request.There should be a queue reason that exists which is for 'Invalid address: Invalid key word detected'
            //tenancyRequestPage.ClickQueueReasons();
            Table queueReasonTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueReasonTable.GetCellContainsValue("Reason", "Invalid address : Invalid keyword detected", "Status Reason"), "To be resolved");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6907_CRMOverrideInvalidKeywordExceptionQueue()
        {
            #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() == "6907")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            //Create new Tenancy Request. Fillup the Rental Premises with some address which has keyword like garage
            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.SetDwellingTypeListValue("House");

            tenancyRequestPage.ClickSaveButton();

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Contains(tenancyRequest, "TR-BL-", "Validating the Tenancy Request saved with the correct TR no fromat");

            tenancyRequestPage.ClickSaveCloseButton();

            //Reopen the record and change the status reason to Ready for Validation and save.The record should show an exception with Invalid Keyword
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "New");

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation failed", "Validation should fail when invalid keyword entered in address details");

            tenancyRequestPage.ClickQueueReasons();
            Table queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Invalid keyword detected", "Reason"), "Invalid keyword detected");

            UICommon.DoubleClickElement(queueTable.GetCellElementContainsValue("Reason", "Invalid keyword detected", "Status Reason"),driver);

            TenancyRequestQueueReasonStatusPage tenancyQueueReasonStatusPage = new TenancyRequestQueueReasonStatusPage(driver);
            Assert.IsFalse(tenancyQueueReasonStatusPage.GetOverrideCheckBoxValue(),"Validating the override checkbox for Invalid keyword queue reason is available for RBS officer");

               //Login with any other user other than RBS operation user and see the override can be done by that user

            driver.Close();
            driver = null;
            this.TestSetup();

            user = this.environment.GetUser(SecurityRole.GeneralStaff);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickQueueReasons();
            queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Invalid keyword detected", "Reason"), "Invalid keyword detected");

            //Open the exception queue and change the reason to resolved. In the tenancy record select a payment type and change the status reason to Ready for validation - SAVE
            UICommon.DoubleClickElement(queueTable.GetCellElementContainsValue("Reason", "Invalid keyword detected", "Status Reason"), driver);

            tenancyQueueReasonStatusPage = new TenancyRequestQueueReasonStatusPage(driver);
            tenancyQueueReasonStatusPage.SetOverrideCheckBox(true);

            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();

            StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "Your changes have not been saved");

            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            //Create new Tenancy Request with fields populated except Payment type
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickQueueReasons();
            queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Invalid keyword detected", "Override"), "No");

            //Once override is done for that tenancy record for Invalid Keyword exception, it should appear as resolved in the queue in subsequent validations.
            //Validation should be successful
            driver.Close();
            driver = null;

            this.TestSetup();

            user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickQueueReasons();
            queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Invalid keyword detected", "Reason"), "Invalid keyword detected");

            UICommon.DoubleClickElement(queueTable.GetCellElementContainsValue("Reason", "Invalid keyword detected", "Status Reason"), driver);

            tenancyQueueReasonStatusPage = new TenancyRequestQueueReasonStatusPage(driver);
            tenancyQueueReasonStatusPage.SetOverrideCheckBox(true);
            tenancyQueueReasonStatusPage.ClickSaveCloseButton();

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClickQueueReasons();
            queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Invalid keyword detected", "Override"), "Yes");

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");

            queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Invalid keyword detected", "Status Reason"), "Resolved");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6908_CRMUpdateTenancyRequestPaymentTypeExceptionQueue()
        {
            #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() == "TR_TestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            //Create new Tenancy Request with fields populated except Payment type
            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestWithoutPaymentType(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString());

            //Record should save successfully
            tenancyRequestPage.ClickSaveButton();

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Contains(tenancyRequest, "TR-BL-","Validating the Tenancy Request saved with the correct TR no fromat");

            tenancyRequestPage.ClickSaveCloseButton();

            //Open the record again and change the Status Reason to Ready for validation and save
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "New");

            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation failed","Validation should fail when payment type is balnk");

            //There should be one exception in the queue for Pyment type missing
            tenancyRequestPage.ClickQueueReasons();
            Table queueTable = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(queueTable.GetCellContainsValue("Reason", "Payment Type is blank", "Reason"), "Payment Type is blank");

            //Open the exception queue and change the reason to resolved. In the tenancy record select a payment type and change the status reason to Ready for validation - SAVE
            UICommon.DoubleClickElement(queueTable.GetCellElementContainsValue("Reason", "Payment Type is blank", "Status Reason"), driver);

            TenancyRequestQueueReasonStatusPage tenancyQueueReasonStatusPage = new TenancyRequestQueueReasonStatusPage(driver);

            StringAssert.Contains(tenancyQueueReasonStatusPage.GetReasonValue(), "Payment Type is blank");
            tenancyQueueReasonStatusPage.SetReasonValue("Resolved");
            tenancyQueueReasonStatusPage.ClickSaveCloseButton();

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.SetPaymentType("BPay");

            tenancyRequestPage.ClickSaveButton();
            //Record should be saved and validation should be successful
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful","Validation should be successful after adding payment type");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6790_TenancyRequestRoomingAccomodation()
        {
            #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() == "6790")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string initialRequestParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();

            //Login as RBS user
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetPageFilterList("All Tenancy Requests");
            Table table = new Table(tenancyRequestSearchPage.GetHeaderSearchResultTable());
            table.ClickTableColumnHeader("Created On");
            table.ClickTableColumnHeader("Created On");

            Table searchTable = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            string lastCreatedTenancyReqNo = searchTable.GetCellContainsValue("Name", "TR-BL", "Name");

            //(Template) - Create new Tenancy Request (Bond Lodgement)
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Set {Type} field to Bond Lodgement.
            tenancyRequestPage.SetRequestTypeListValue("Bond Lodgement");
            tenancyRequestPage.SetTenancyTypeListValue("Rooming Accommodation");

            //Check Dwelling Type field	1. Lookup list filtered to only: [ Boarding House | Supported Accommodation | Student Accommodation off Campus |Studio]
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Boarding House"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Supported Accommodation"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Student Accommodation off Campus"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Studio"));

            //Set Dwelling Type to Boarding House.Number of Bedrooms defaults to 1 and shows as read only
            tenancyRequestPage.SetDwellingTypeListValue("Boarding House");
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(), "1");
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedroomsProperty("data-controlmode"), "locked");

            //Set Dwelling Type to Supported Accommodation.Number of Bedrooms defaults to 1 and shows as read only
            tenancyRequestPage.SetDwellingTypeListValue("Supported Accommodation");
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(), "1");
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedroomsProperty("data-controlmode"), "locked");

            //Set Dwelling Type to Studio	Number of Bedrooms defaults to 1 and shows as read only
            tenancyRequestPage.SetDwellingTypeListValue("Studio");
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(), "1");
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedroomsProperty("data-controlmode"), "locked");

            //Set Dwelling Type to Student Accommodation off Campus.Number of Bedrooms defaults to 1 and shows as read only
            tenancyRequestPage.SetDwellingTypeListValue("Student Accommodation off Campus");
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(), "1");
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedroomsProperty("data-controlmode"), "locked");

            //Check Management Type field. Lookup list filtered to only: [ Owner (or can be Lessor/Owner) | Real Estate Agent | Manager/provider | Other ]
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Lessor/Owner"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Real Estate Agent"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Manager/provider"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Other"));

            //Set Rental Premise to an address with the following details: [Type, "Australian Physical" | Locality populated | Room/Site Number NOT populated]
            //Example:"33 SHORE ST, EAST BRISBANE, QLD, 4169"
            string roadnumber = "33";
            string roadname = "SHORE ST";
            string locality = "EAST BRISBANE, QLD, 4169";

            tenancyRequestPage.CreateNewAddress(roadnumber,roadname,locality);
            tenancyRequestPage = new TenancyRequestPage(driver);

            //Populate mandatory fields. Save record.
            tenancyRequestPage.SetManagingPartyListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString());
            tenancyRequestPage.SetTenancyManagementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString());
            tenancyRequestPage.SetInitialRequestPartyWithSearch(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString());
            tenancyRequestPage.SetInitialConrtibution(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString());
            tenancyRequestPage.SetAmountPaidWithLodgement(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString());
            tenancyRequestPage.SetLodgementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();

            //Record saves. Soft warning (Missing room number): DISPLAYED
            StringAssert.Contains(tenancyRequestPage.GetWarningMessage(), "The selected address does not have a Room/Site number.");

            /*The Name field for the Tenancy Request will be populated with 'TR-BL-' and concatenated with the Reference Number field that will be populated
            with increments of 1 from the most recent Tenancy request record. Example: Given the most recent Tenancy Request name is 'TR-BL-20000016' then this record will be 'TR-BL-20000017'*/
            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Contains(tenancyRequest, "TR-BL", "Validating the newly created tenancy request has TR-BL format");
            int oldTRNo = Int32.Parse(lastCreatedTenancyReqNo.Split('-')[2]);
            int newTRNo = Int32.Parse(tenancyRequest.Split('-')[2]);
            Assert.AreEqual(oldTRNo + 1, newTRNo, "Validating the TR No is incremented by 1 from the last created TR");

            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);

            searchTable = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            //Check record in record grid. As updated/entered
            StringAssert.Contains(searchTable.GetCellContainsValue("Name",tenancyRequest,"Tenancy Type"), "Rooming Accommodation");
            StringAssert.Contains(searchTable.GetCellContainsValue("Name",tenancyRequest,"Managing Party"),MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString());
            StringAssert.Contains(searchTable.GetCellContainsValue("Name",tenancyRequest,"Rental Premises"),MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString());
            StringAssert.Contains(searchTable.GetCellContainsValue("Name", tenancyRequest, "Dwelling Type"), "Student Accommodation off Campus");
            StringAssert.Contains(searchTable.GetCellContainsValue("Name", tenancyRequest, "Amount Bond Paid with Lodgement").Replace(",",""), MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString());

            searchTable.ClickCellContainsValue("Name", tenancyRequest, "Name");

            //Remove Rental Premise address. Save record.	Record not saved as field is mandatory.
            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.ClearRentalPremisesValue();

            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetRentalPremiseAddressErrorText(), "You must provide a value for Rental Premises.");
            tenancyRequestPage.ClickPageTitle();

            //Set Rental Premise to an address with the following details: [Type, "Australian Physical" | Locality populated | Room/Site Number populated]
            //Example: "RM 4, 33 SHORE ST, EAST BRISBANE, QLD, 4101"	Record saves. Soft warning (Missing room number): NOT DISPLAYED
            string roomtype = "Room";
            string roomno = "4";
            tenancyRequestPage.CreateNewAddress(roadnumber, roadname, locality, roomtype, roomno);
            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickSaveButton();

            Assert.IsFalse(tenancyRequestPage.GetWarningMessage().Contains("The selected address does not have a Room/Site number."));
            tenancyRequestPage.ClickSaveCloseButton();

            //Check record in record grid	As updated/entered
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            searchTable = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(searchTable.GetCellContainsValue("Name", tenancyRequest, "Rental Premises"), "RM 4, 33 SHORE ST, EAST BRISBANE, QLD, 4169");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6905_CRMTenancyrequestStatusReasonRemoveValidationSuccessfuldropdownvalue()
        {
            #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() == "6905")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //read excel file and get test data for this test
            // store test data in a class so that it can be used later

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            //Attemp to save with Mandatory data
            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Equals(tenancyrequest, "TR-BL-");

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6780_CRMNewTenancyRequestTestResidentialTenancyTest()
        {
            #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() == "6780")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Attemp to save with NO Mandatory data
            tenancyRequestPage.SetRequestTypeListValue("Bond Lodgement");
            tenancyRequestPage.ClickSaveButton();
            //StringAssert.StartsWith(tenancyRequestPage.GetRentalPremiseAddressErrorText(), "You must provide a value for Rental Premises.");

            //Attempt to Enter Invalid Bedroom values
            tenancyRequestPage.SetNumberOfBedrooms("0");
            StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12.");
            StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12.");

            //Attempt to Enter Invalid Bedoom values
            tenancyRequestPage.SetNumberOfBedrooms("13");
            StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12.");
            StringAssert.Contains(tenancyRequestPage.GetAlertMessage(), "You must enter a whole number between 1 and 12.");

            //Attempt to Enter Invalid Bedroom values
            tenancyRequestPage.SetNumberOfBedrooms("1");
            //StringAssert.Contains(tenancyRequestPage.GetRTAValidationMessage(), "You must");  This needs a ! contrains

            //Attemp to save with Mandatory data
            // tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy("1 THOMAS ST, BIRKDALE, QLD, 4159", "Residential Tenancy", "AMANDA TEST", "3", "AARON BALL", "700", "700", "Initial");
            tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            StringAssert.Equals(tenancyRequestPage.GetRequestNumber(), "TR-BL-");

            //Assert the warning message regarding Tenancy Start Date and Total Contribution amount
            warningMessage = tenancyRequestPage.GetWarningMessage();
            StringAssert.Contains(warningMessage, "Tenancy Start is blank, please select a date.");

            //Fill in start date and check that warning message is removed
            //tenancyRequestPage.ClickTenancyStartDate();
            tenancyRequestPage.SetTenancyStartDate("01/03/2015");
            tenancyRequestPage.ClickSaveButton();
            //StringAssert.Contains(tenancyRequestPage.GetWarningMessage(),"Tenancy Start is blank, please select a date.");

            //Assert that Date Bond Received at RTA is read only
            controlMode = tenancyRequestPage.GetPropertyDataControlModeRTADateReceivedAtRTA();
            StringAssert.Equals(controlMode, "locked");

            //Assert that Funded Status is read only
            controlMode = tenancyRequestPage.GetPropertyDataControlModeRTAFundedStatus();
            StringAssert.Equals(controlMode, "locked");

            String tenancyNumber = tenancyRequestPage.GetRequestNumber();
            StringAssert.StartsWith(tenancyNumber, "TR-BL-");

            //Assert that saved record can be found in the record grid
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyNumber);

            Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable());

            //Assert that the status reason can be confirmed on the table
            StringAssert.Equals(table.GetCellValue("Name", tenancyNumber, "Status Reason"), "New");

            //Assert that a value in a particular column in a table exists
            StringAssert.Equals(table.GetCellContainsValue("Name", tenancyNumber, "Amount Bond Paid with Lodgement"),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString());

            ////Assert that a search result record can be opened
            table.ClickCellValue("Name", tenancyNumber, "Name");
            tenancyRequestPage = new TenancyRequestPage(driver);
            StringAssert.Equals(tenancyRequestPage.GetRequestNumber(), tenancyNumber);

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4399_CRMDisplaydwellingtype()
        {
            #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() == "4399")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            //tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy("1 THOMAS ST, BIRKDALE, QLD, 4159", "Residential Tenancy", "AMANDA TEST", "3", "AARON BALL", "700", "700", "Initial");
            tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            //tenancyRequestPage.ClickSaveButton();

            ////Assert Dwelling Type field

            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Flat/Unit"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("House"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Townhouse/Semi-Detached House"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Student Accommodation on Campus"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Moveable Dwelling/Site"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Moveable Dwelling/Site with electricity supplied and individually metered"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Studio"));

            ////Change Tenancy type
            //tenancyRequestPage.ClickTenancyTypeList();
            tenancyRequestPage.SetResidentialTenancyTypeList("Rooming Accommodation");
            tenancyRequestPage.SetResidentialManagementTypeList("Lessor/Owner");
            ////Assert Dwelling Type field
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Boarding House"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Supported Accommodation"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Student Accommodation off Campus"));
            tenancyRequestPage.ClickPageTitle();
            Assert.IsTrue(tenancyRequestPage.GetDwellingTypeText("Studio"));

            //Assert Save Successful
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetRequestNumber(), "TR-BL-");

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            tenancyRequestPage.ClickSaveCloseButton();

            //Assert record in search table
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Tenancy Type"), "Rooming Accommodation");

            //Change Dwelling and check search table again
            table.ClickCellValue("Name", tenancyRequest, "Name");
            tenancyRequestPage = new TenancyRequestPage(driver);

            //tenancyRequestPage.ClickTenancyTypeList();
            tenancyRequestPage.SetResidentialTenancyTypeList("Residential Tenancy");
            tenancyRequestPage.SetResidentialManagementTypeList("Lessor/Owner");
            tenancyRequestPage.ClickSaveCloseButton();

            //Assert record in search table
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Tenancy Type"), "Residential Tenancy");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6751a_CRMBTriggerUpdateToCheque()
        {
            #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() == "6751")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string initialRequestParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString();
            string amountOtherParty = (MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value +
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC2")].Value).ToString();

            //Login as RBS user
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managingParty,
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.SetDwellingTypeListValue("House");

            tenancyRequestPage.ClickSaveButton();

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            tenancyRequestPage.ClickSaveButton();
            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest;
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

            //Reopen the record and change the status reason to Ready for Validation and save.The record should show an exception with Invalid Keyword
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            table.ClickCellValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            table = new Table(tenancyRequestPage.GetPaymentSummaryResultTable());

            string referencenumber = table.GetCellValue("Tenancy Request", tenancyRequest, "Reference Number");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value = referencenumber;
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Pending Financials");
            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Payment pending");

            //Create EFT file with new reference number
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value = Utils.BAI2FileCreator.bAI2FileCreator(referencenumber, amountOtherParty);

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4422_CRMTenancyRequestWithNoContributor()
        {
            #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() == "TR_TestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string initialRequestParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString();
            string initialContribution = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();
            string rentalPremises = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString();

            //Login as RBS user
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //As a RBS Officer, navigate to an Address Detail
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaAddressDetailRibbonButton();

            AddressDetailSearchPage addressDetailSearchPage = new AddressDetailSearchPage(driver);
            addressDetailSearchPage.SetAddressDetailSearchText("MITCHELTON");

            Table addressSearchTable = new Table(addressDetailSearchPage.GetSearchResultTable());
            addressSearchTable.ClickCellContainsValue("Name", rentalPremises, "Name");

            AddressDetailPage addressDetailPage = new AddressDetailPage(driver);

            //Click on the Tenancy Requests Associated View in the dropdown ribbon menu
            homePage.HoverAddressDetailRibbonTab(rentalPremises);
            homePage.ClickTRAddressDetailViewRibbonButton();

            addressDetailPage = new AddressDetailPage(driver);

            string BaseWindow = driver.CurrentWindowHandle;
            addressDetailPage.ClickAddNewTenancyRequestButton();
            addressDetailPage.SwitchNewBrowser(driver, BaseWindow);

            //Fill in all mandatory details and Click Save&close
            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Set {Type} field to Bond Lodgement.
            tenancyRequestPage.SetRequestTypeListValue("Bond Lodgement");

            tenancyRequestPage.PopulateTenancyRequestWithoutRentalPremisesFromAddressDetailAssociatedView(
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
              initialRequestParty,
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
              initialContribution,
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
              MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString());
            tenancyRequestPage.ClickSaveButton();

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Contains(tenancyRequest, "TR-BL-", "Validating the Tenancy Request saved with the correct TR no fromat");

            tenancyRequestPage.ClickSaveCloseButton();
            driver = driver.SwitchTo().Window(BaseWindow);

            //Open the Tenancy Request which was just created
            addressDetailPage = new AddressDetailPage(driver);
            addressDetailPage.SetTenancyRequestSearchText(tenancyRequest);

            Table tenancyRequestSearchTable = new Table(addressDetailPage.GetTenancyRequestSearchResultTable());
            tenancyRequestSearchTable.ClickCellContainsValue("Name", tenancyRequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            Table requestPartyTable = new Table(tenancyRequestPage.GetRequestPartyTable());

            //Confirm the tenancy request has only one contributor i.e initial Request Party
            Assert.AreEqual(requestPartyTable.GetCellContainsValue("Request Amount",initialContribution,"Client"), initialRequestParty);
            Assert.AreEqual(1, requestPartyTable.GetRowCount()-1,"Validating only one contributor is avaialble");

            UICommon.DoubleClickElement(requestPartyTable.GetCellElementContainsValue("Client", initialRequestParty, "Client"), driver);
            Thread.Sleep(1000);
            TenancyRequestPartyPage tenancyRequestPartyPage = new TenancyRequestPartyPage(driver);
            tenancyRequestPartyPage.ClickPageTitle();

            //Try to deactivate the contributor. Fails with an error dialog
            tenancyRequestPartyPage.ClickDeactivateButton();
            WarningDialogueFramePage warningPage = new WarningDialogueFramePage(driver);
            warningPage.ClickProcessBeginButton();

            tenancyRequestPartyPage.ClickSaveCloseButton();

            //Go back to tenancy request form. The Delete button should not be available for RBS user
            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            requestPartyTable = new Table(tenancyRequestPage.GetRequestPartyTable());

            Assert.AreEqual(requestPartyTable.GetCellContainsValue("Request Amount", initialContribution, "Client"), initialRequestParty);
            Assert.AreEqual(1, requestPartyTable.GetRowCount() - 1, "Validating the initial contributor is still avaialble after trying to deactivate");

            IWebElement element = requestPartyTable.GetCellElementContainsValue("Client", initialRequestParty, "Request Amount");
            Assert.IsFalse(tenancyRequestPage.ClickDeleteButtonIfDisplayed(element),"Validating that delete button not displyed to click");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6365c_CRMTESTINGEndtoEndSingleFormBPayAXSuccess()
        {
            #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() == "6365")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string tenancyRequest = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.SetPageFilterList("All Tenancy Requests");

            Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTableColHeadings());
            table.ClickTableColumnHeader("Created On");
            table.ClickTableColumnHeader("Created On");

            table = new Table(tenancyRequestsSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "Completed");
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Processing Status"), "Financials processing successful");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4462_CRMPaymentTypefieldforTenancyRequestTestaudithistory()
        {
            #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() == "TR_TestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string tenancyRequestReference;
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managingParty,
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.SetResidentialTenancyTypeList("Rooming Accommodation");
            tenancyRequestPage.SetResidentialManagementTypeList("Lessor/Owner");
            tenancyRequestPage.ClickSaveButton();
            tenancyRequestReference = tenancyRequestPage.GetRequestNumber();

            //Change Tenancy Type

            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedrooms(), "1");
            StringAssert.Contains(tenancyRequestPage.GetNumberOfBedroomsProperty("data-controlmode"), "locked");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6629c_CRMTESTINGEndtoEndSingleFormBPayCRM()
        {
            #region Start Up Excel
            MyApp = new Excel.Application();
            MyApp.Visible = false;
            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()== "6629")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string tenancyrequest = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value.ToString();
            string bond = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value.ToString();

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRibbonButton();

            TenancySearchPage tenancySearchPage = new TenancySearchPage(driver);
            tenancySearchPage.SetTenancySearchText(bond);

            Table table = new Table(tenancySearchPage.GetSearchResultTable());
            table.SelectTableRow("Bond Number", bond);

            TenancyPage tenancyPage = new TenancyPage(driver);
            tenancyPage.HoverBondPropertyRibbonTab();
            tenancyPage.ClickBondTenancyRequestRibbonButton();
            tenancyPage.ClickSelectViewButton();
            tenancyPage.SetViewList("All Tenancy Requests");

            table = new Table(tenancyPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyrequest, "Name"), tenancyrequest);
            table.ClickCellValue("Name", tenancyrequest, "Name");

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Financials processing successful");
            StringAssert.Contains(tenancyRequestPage.GetPropertyDataControlModeRTAFundedStatus(), "deactivated");
            StringAssert.Contains(tenancyRequestPage.GetAmountMatched(), "$1,000.00");
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Completed");

            //reveiced date?? step 19

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC9851_CRMChangeOfMPMandatoryFieldsValidationsAC3NoContributorsExceptionOverride()
        {
            #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() == "9851")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            //Login as RBS Claims Officer user role.
            User user = this.environment.GetUser(SecurityRole.RBSClaimsOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            //Click [+NEW] button.
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Set {Type} field to Change of Managing Party.
            //
            tenancyRequestPage.SetRequestTypeListValue("Change of Managing Party");

            //Populate all other mandatory fields required for successful validation (as per stories 6792/6793) without a Request Party
            tenancyRequestPage.PopulateTenancyRequestChangeOfManagingPartyWithoutRequestParty(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC1")].Value.ToString(),
                DateTime.Now.ToString("dd/MM/yyyy"),
                DateTime.Now.ToString("dd/MM/yyyy"),
                DateTime.Now.ToString("dd/MM/yyyy"),
                DateTime.Now.ToString("dd/MM/yyyy"),
                "Signature verified",
                "Signature verified");

            //Click [Save] button to unlock {Status Reason}
            tenancyRequestPage.ClickSaveButton();

            //Set {Status Reason} to "Ready for validation".
            tenancyRequestPage.SetStatusReason("Ready for validation");

            //Click [Save] button.
            tenancyRequestPage.ClickSaveButton();

            //Assert: {Status Reason} becomes "Validation failed".
            StringAssert.Equals(tenancyRequestPage.GetStatusReason(), "Validation failed");

            //Inspect Queue Reasons section.
            tenancyRequestPage.ClickQueueReasons();  //This may not be necessary.

            //Assert: An exception queue entry is created with reason type: "At least one contributor required"
            Table table = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(table.GetCellContainsValue("Reason", "Invalid number of contributors", "Reason"), "Invalid number of contributors");

            //Double-click on exception queue record.
            //UICommon.DoubleClickElement(table.GetCellElementContainsValue("Reason", "Invalid Contributor : At least one contributor required", "Status Reason"), driver);
            table.ClickCellContainsValueEnterRow("Reason", "Invalid number of contributors", "Status Reason");
            TenancyRequestQueueReasonPage tenancyRequestQueueReasonPage = new TenancyRequestQueueReasonPage(driver);

            //Click {Override} checkbox to select/tick it.
            tenancyRequestQueueReasonPage.SetOverrideCheckBox(true);

            //Click [SAVE & CLOSE] button.
            tenancyRequestQueueReasonPage.ClickSaveCloseButton();
            tenancyRequestPage = new TenancyRequestPage(driver);

            //Set {Status Reason} to "Ready for validation".
            tenancyRequestPage.SetStatusReason("Ready for validation");

            //Click [Save] button.
            tenancyRequestPage.ClickSaveButton();

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);

            table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            table.GetCellValue("", "", "");
            //Assert: {Status Reason} becomes "Validation successful".
            //StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Validation successful");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6736_CRMPrepopulateTenancyfieldsfromknownpremisedetailsDwellingType()
        {
            #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() == "6736")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string managingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managingParty,
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();

            //Assert Dwelling Value
            StringAssert.Contains(tenancyRequestPage.GetDwellingType(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString());
            tenancyRequestPage.ClickSaveCloseButton();

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6629a_CRMTESTINGEndtoEndSingleFormBPayCRM()
        {
            #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()== "6629")
                {
                    MyRow = i;
                    break;
                }

            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //read excel file and get test data for this test
            // store test data in a class so that it can be used later

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Equals(tenancyrequest, "TR-BL-");

            //Add a new request party
            //tenancyRequestPage.ClickRequestPartyAssociated();

            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handle

            tenancyRequestPage.ClickAddNewRequestPartyImage();

            //Enter Request Party details

            driver = tenancyRequestPage.SwitchNewBrowser(driver, BaseWindow);

            TenancyRequestPartyPage tenancyRequestPartyPage = new TenancyRequestPartyPage(driver);
            tenancyRequestPartyPage.SetClientNameValue(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MISC1")].Value.ToString());
            tenancyRequestPartyPage.SetAmountValue("500.00");
            tenancyRequestPartyPage.ClickSaveCloseButton();

            string amountOtherParty = (MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value + 500).ToString();
            driver = driver.SwitchTo().Window(BaseWindow);
            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyrequest);

            Assert.IsTrue(tenancyRequestsSearchPage.GetPaymentRefernceRefreshTable(tenancyrequest));

            Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Name", tenancyrequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            table = new Table(tenancyRequestPage.GetPaymentSummaryResultTable());

            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Tenancy Request"), tenancyrequest);
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Request Batch"), "");
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Payment Type"), "BPay");
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Amount"), "$2,000.00");
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Client"), "BLAIR TEST");
            string referencenumber = table.GetCellValue("Tenancy Request", tenancyrequest, "Reference Number");
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Pending Financials");
            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Payment pending");
            string dateValue = DateTime.Today.AddDays(-1).ToString("yyyyMMdd");
            string fileLocation = Utils.BPayFileCreator.bPayFileCreator(referencenumber, dateValue, tenancyrequest, "200000");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value = fileLocation;
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest;
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value = referencenumber;
            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC9857_CRMRBSClaimsUserCannotTouchBLTR()
        {
            string requestType = "Bond Lodgement";

            //Login as RBS Claims Officer user role.
            User user = this.environment.GetUser(SecurityRole.RBSClaimsOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Rental Bond Services > Tenancy Requests
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            //Click [+NEW] button.
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //Inspect {Type} field dropdown values.
            //Assert:Dropdown item "Bond Lodgement" should not be available.

            Assert.IsFalse(tenancyRequestPage.isRequestType(requestType), "We expected Request Type: " + requestType + ", to not be in the list but we found it.");
        }
        public void ATC6837c_CRMCancelBPayRequestBatchWithTopup()
        {
            #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 tRow1 = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "Topup_6837")
                {
                    tRow1 = i;
                    break;
                }
            }
            #endregion

            string managepingParty = MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);
            //Creating topup tenancy req for 6837
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managepingParty,
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                (MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value + 50).ToString(),
                "25",
                "50",
                "Top up",
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());
            tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString());

            tenancyRequestPage.SetTenancyValue(MyRange.Cells[tRow1 , TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value.ToString());
            tenancyRequestPage.ClickSaveButton();
            string topuptenancyrequest = tenancyRequestPage.GetRequestNumber();
            MyRange.Cells[tRow1, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = topuptenancyrequest;

            tenancyRequestPage.ClickSaveCloseButton();

            //Creating one initial tenacy request for 6837
            int tRow2 = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "Initial_6837")
                {
                    tRow2 = i;
                    break;
                }
            }

            tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managepingParty,
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());
            tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            string initialtenancyrequest = tenancyRequestPage.GetRequestNumber();
            tenancyRequestPage.ClickSaveCloseButton();
            MyRange.Cells[tRow2, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = initialtenancyrequest;
        }
        public void ATC4400_CRM1514EnterdataManagementTypes()
        {
            #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() == "4400")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            //tenancyRequestPage.ClickSaveButton();

            ////Assert Management Type field
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Lessor/Owner"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Real Estate Agent"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Moveable dwelling owner/manager"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Community Housing Organisation"));
            //Assert.IsTrue(tenancyRequestPage.GetRTATenancyManagementTypeListValue("Other));

            ////Change Tenancy type
            tenancyRequestPage.SetResidentialTenancyTypeList("Rooming Accommodation");
            tenancyRequestPage.SetResidentialManagementTypeList("Lessor/Owner");
            ////Assert Dwelling Type field
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Lessor/Owner"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Real Estate Agent"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyManagementTypeListValue("Manager/provider"));
            //Assert.IsTrue(tenancyRequestPage.GetRTATenancyManagementTypeListValue("Other));

            //Assert Save Successful
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetRequestNumber(), "TR-BL-");

            string tenancyRequest = tenancyRequestPage.GetRequestNumber();
            tenancyRequestPage.ClickSaveCloseButton();

            //Assert record in search table
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Name"), tenancyRequest);

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC6904a_CRMTopupExcessBondValidation()
        {
            #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

            //Data preparation step-Tenancy with bond balance of 100

            //Creating a tenancy request for the data prep
            string managepingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.SetRequestTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString());
            string rentalPremises = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString();

            string[] address = rentalPremises.Split(',');

            string roadno = address[0].Split(' ')[0];
            string roadname = address[0].Split(' ')[1];
            string locality = address[1].Split(' ')[1] + "," + address[2] + "," + address[3];

            tenancyRequestPage.CreateNewAddress(roadno,roadname,locality,"Room");
            tenancyRequestPage = new TenancyRequestPage(driver);

            tenancyRequestPage.SetManagingPartyListValue(managepingParty);
            tenancyRequestPage.SetTenancyTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString());
            tenancyRequestPage.SetTenancyManagementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString());
            tenancyRequestPage.SetInitialRequestPartyWithSearch(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString());
            tenancyRequestPage.SetInitialConrtibution(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString());
            tenancyRequestPage.SetAmountPaidWithLodgement(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString());
            tenancyRequestPage.SetLodgementTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.SetWeeklyRent(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString());
            tenancyRequestPage.SetTenancyStartDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString());
            tenancyRequestPage.SetAnticipatedEndDate(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString());
            tenancyRequestPage.SetPaymentType(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.SetDwellingTypeListValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("DWELLING_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();

            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest;
            string amount = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString();
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyrequest);
            Assert.IsTrue(tenancyRequestsSearchPage.GetPaymentRefernceRefreshTable(tenancyrequest));

            Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Name", tenancyrequest, "Name");

            tenancyRequestPage = new TenancyRequestPage(driver);
            table = new Table(tenancyRequestPage.GetPaymentSummaryResultTable());

            string referencenumber = table.GetCellValue("Tenancy Request", tenancyrequest, "Reference Number");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value = referencenumber;
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Pending Financials");
            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Payment pending");

            //Create BPay file with new reference number
            string dateValue = DateTime.Today.ToString("yyyyMMdd");
            string fileLocation = Utils.BPayFileCreator.bPayFileCreator(referencenumber, dateValue, tenancyrequest, MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString() + "00");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value = fileLocation;

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4394_CRMEnterdatafromForm()
        {
            #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() == "4394")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string tenancyRequest;
            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);

            tenancyRequestSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            //tenancyRequestPage.PopulateTenancyRequestFormResidentialTenancy("1 THOMAS ST, BIRKDALE, QLD, 4159", "Residential Tenancy", "AMANDA TEST", "3", "AARON BALL", "700", "700", "Initial");
            tenancyRequestPage.PopulateTRNoTenancyType(
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString(),
               MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            tenancyRequestPage.ClickSaveButton();
            //Assert Save unsuccessful without Tenancy Type
            StringAssert.StartsWith(tenancyRequestPage.GetTenancyTypeErrorText(), "You must provide a value for Tenancy Type.");
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.SetResidentialTenancyTypeList("Residential Tenancy");
            tenancyRequestPage.SetResidentialManagementTypeList("Lessor/Owner");
            //Assert Save Successful
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetRequestNumber(), "TR-BL-");
            tenancyRequest = tenancyRequestPage.GetRequestNumber();

            //Assert List Values
            //tenancyRequestPage.ClickTenancyTypeList();
            Assert.IsTrue(tenancyRequestPage.GetTenancyTypeListValue("Residential Tenancy"));
            Assert.IsTrue(tenancyRequestPage.GetTenancyTypeListValue("Rooming Accommodation"));
            tenancyRequestPage.SetResidentialManagementTypeList("Lessor/Owner");

            tenancyRequestPage.ClickSaveCloseButton();

            //Assert record in search table
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText(tenancyRequest);
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            StringAssert.Contains(table.GetCellValue("Name", tenancyRequest, "Status Reason"), "New");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC7120a_CRMAC1Fileformatverification()
        {
            #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 managepingParty = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGING_PARTY")].Value.ToString();
            string amountPaidLodgement = MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("AMOUNT_PAID_LODGEMENT")].Value.ToString();

            User user = this.environment.GetUser(SecurityRole.RBSOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.ClickNewTenancyRequestButton();

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();

            tenancyRequestPage.PopulateTenancyRequestValidationSuccessful(
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("REQUEST_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("RENTAL_PREMISES")].Value.ToString(),
                managepingParty,
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("MANAGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("NO_ROOMS")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_REQUEST_PARTY")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("WEEKLY_RENT")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString(),
                amountPaidLodgement,
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("LODGEMENT_TYPE")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TENANCY_START")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("ANTICIPATED_END")].Value.ToString(),
                MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAYMENT_TYPE")].Value.ToString());

            tenancyRequestPage.ClickSaveButton();
            string tenancyrequest;
            tenancyrequest = tenancyRequestPage.GetRequestNumber();
            StringAssert.Equals(tenancyrequest, "TR-BL-");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest;

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            StringAssert.Contains(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

            tenancyRequestsSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestsSearchPage.SetTenancyRequestSearchText(tenancyrequest);
            Table table = new Table(tenancyRequestsSearchPage.GetSearchResultTable());
            table.ClickCellValue("Name", tenancyrequest, "Name");
            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetStatusReason(), "Pending Financials");
            StringAssert.Contains(tenancyRequestPage.GetFundedStatus(), "Payment pending");
            table = new Table(tenancyRequestPage.GetPaymentSummaryResultTable());
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Tenancy Request"), tenancyrequest);
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Payment Type"), "BPay");
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Amount"),
                ((double)Int32.Parse(amountPaidLodgement)).ToString("C"));
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Client"), managepingParty);
            string referencenumber = table.GetCellValue("Tenancy Request", tenancyrequest, "Reference Number");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("PAY_REF_NUMBER")].Value = referencenumber;

            //Create BPay file with new reference number
            string dateValue = DateTime.Today.ToString("yyyyMMdd");
            string fileLocation = Utils.BPayFileCreator.bPayFileCreator(referencenumber, dateValue, tenancyrequest, MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("INITIAL_CONTRIBUTION")].Value.ToString() + "00");
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("OUTFILE")].Value = fileLocation;

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }
        public void ATC4410_CRMDisplaythefundedstatus()
        {
            User user = this.environment.GetUser(SecurityRole.SystemAdministrator);
            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickRBSRibbonButton();
            homePage.HoverRBSRibbonTab();
            homePage.ClickRtaTenancyRequestRibbonButton();

            TenancyRequestsSearchPage tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            //Assert record in search table
            tenancyRequestSearchPage = new TenancyRequestsSearchPage(driver);
            tenancyRequestSearchPage.SetTenancyRequestSearchText("BLAIR TEST");
            Table table = new Table(tenancyRequestSearchPage.GetSearchResultTable());
            table.ClickCellValue("Managing Party", "BLAIR TEST", "Name");

            TenancyRequestPage tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            StringAssert.Contains(tenancyRequestPage.GetPropertyDataControlModeRTAFundedStatus(), "locked");
        }