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 ATC6911c_TenancytopupvalidationSameaddresssamemanagingparty()
        {
            #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() == "6911")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            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.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 + 50).ToString(),
                "25",
                "50",
                "Top up",
                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.SetTenancyValue(MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("BOND_REF")].Value.ToString());
            tenancyRequestPage.ClickSaveButton();
            string tenancyrequest = tenancyRequestPage.GetRequestNumber();
            MyRange.Cells[MyRow, TenancyRequestSchema.GetColumnIndex("TR_NUMBER")].Value = tenancyrequest;

            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            Thread.Sleep(5000);
            tenancyRequestPage.ClickSaveButton();
            Table table = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(table.GetCellContainsValue("Reason", "Invalid list of Parties", "Tenancy Request"), tenancyrequest);
            table.ClickCellContainsValueEnterRow("Reason", "Invalid list of Parties", "Status Reason");

            TenancyRequestQueueReasonPage tenancyRequestQueueReasonPage = new TenancyRequestQueueReasonPage(driver);
            tenancyRequestQueueReasonPage.SetStatusReasonValue("Resolved", driver);
            tenancyRequestQueueReasonPage.ClickSaveCloseButton();

            tenancyRequestPage = new TenancyRequestPage(driver);
            table = new Table(tenancyRequestPage.GetQueueReasonTable());
            StringAssert.Contains(table.GetCellValue("Tenancy Request", tenancyrequest, "Status Reason"), "Resolved");

            //Add a new request party
            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("25");
            tenancyRequestPartyPage.ClickSaveCloseButton();
            driver = driver.SwitchTo().Window(BaseWindow);

            tenancyRequestPage = new TenancyRequestPage(driver);
            tenancyRequestPage.ClickPageTitle();
            tenancyRequestPage.SetStatusReason("Ready for validation");
            tenancyRequestPage.ClickSaveButton();
            Assert.AreEqual(tenancyRequestPage.GetValidationStatusReason(), "Validation successful");
            tenancyRequestPage.ClickSaveCloseButton();

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

            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 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
        }