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