public void ATC3342_CRMInvestigationTestActivitiesCreatedBySelectingSubStatus()
        {
            InvestigationCaseSearchPage investigationCaseSearchPage;
            InvestigationCasePage investigationCasePage;
            string investigationID;

            //Login in as role
            User user = this.environment.GetUser(SecurityRole.Investigations);
            new LoginDialog().Login(user.Id, user.Password);

            string[] Status = new string[] { "New case", "Investigation current", "Investigation current" , "Investigation current", "Investigation current", "Investigation current", "Investigation current", "Case finalisation", "Case finalisation", "Case finalisation"};
            string[] SubStatus = new string[] { "Initial assessment", "Conducting background searches", "Requesting information from complainant(s)" ,"Requesting information from third parties", "Search warrant(s) required", "Allegations to be put to respondent(s)", "Seeking legal advice", "Case closed discussion", "Educating respondent(s)", "Prosecution required"};
            string[] Activities0 = { "Carry out initial assessment", "Allocate"};
            string[] Activities1 = { "Conduct respondent(s) background searches", "Conduct complainant(s) background searches", "Conduct relevant dispute searches", "Conduct relevant premises background searches" };
            string[] Activities2 = { "Send request for information to complainant(s)", "Receive response from complainant" };
            string[] Activities3 = { "Send request for information to third parties", "Receive response from third parties" };
            string[] Activities4 = {"Discuss with Manager", "Prepare warrant application(s)", "Receive approval of warrant(s)"};
            string[] Activities5 = { "Send letter of allegations to respondent", "Receive response from respondent" };
            string[] Activities6 = { "Discuss with SIO or Manager", "Prepare request for legal advice", "Receive legal advice" };
            string[] Activities7 = { "Conduct closure discussion", "Record closure discussion outcome" };
            string[] Activities8 = { "Send educative letter to respondent(s)" };
            string[] Activities9 = { "Prepare brief of evidence", "Seek legal endorsement", "Receive legal advice" };

            HomePage homePage = new HomePage(driver);
            String HomeWindow = driver.CurrentWindowHandle;

            for (int i = 0; i < Status.Length; i++)
            {

                homePage.HoverCRMRibbonTab();
                homePage.ClickInvestigationsRibbonButton();
                homePage.HoverInvestigationsRibbonTab();
                homePage.ClickInvestigationsCasesRibbonButton();

                investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
                String BaseWindow = driver.CurrentWindowHandle;
                investigationCaseSearchPage.ClickNewInvestigationCaseButton();

                investigationCasePage = new InvestigationCasePage(driver);
                investigationCasePage.ClickSaveButton();
                investigationID = investigationCasePage.GetInvestigationCaseNumber();
                investigationCasePage.ClickSaveCloseButton();

                // Search for the Investigation Case ID
                investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
                investigationCaseSearchPage.SetSearchRecord(investigationID);

                Table table = new Table(investigationCaseSearchPage.GetSearchResultTable());
                table.ClickCellValue("Case Number", investigationID, "Case Number");

                investigationCasePage = new InvestigationCasePage(driver);

                investigationCasePage.SetStatus(Status[i]);
                investigationCasePage.ClickPageTitle();
                investigationCasePage.SetSubStatus(SubStatus[i]);

                investigationCasePage.ClickSaveCloseButton();

                // Search for the Investigation Case ID
                investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
                investigationCaseSearchPage.SetSearchRecord(investigationID);

                table = new Table(investigationCaseSearchPage.GetSearchResultTable());
                table.ClickCellValue("Case Number", investigationID, "Case Number");

                // Verify the Activities created
                driver.Navigate().Refresh();
                Thread.Sleep(1000);

                investigationCasePage = new InvestigationCasePage(driver);
                investigationCasePage.SetPageFilterList("All Activities");
                Thread.Sleep(1000);
                table = new Table(investigationCasePage.GetActivitiesSearchResultTable());

                string[] ActivityArray = {""};
                switch (i)
                {
                    case 0:
                        ActivityArray = Activities0;
                        break;
                    case 1:
                        ActivityArray = Activities1;
                        break;
                    case 2:
                        ActivityArray = Activities2;
                        break;
                    case 3:
                        ActivityArray = Activities3;
                        break;
                    case 4:
                        ActivityArray = Activities4;
                        break;
                    case 5:
                        ActivityArray = Activities5;
                        break;
                    case 6:
                        ActivityArray = Activities6;
                        break;
                    case 7:
                        ActivityArray = Activities7;
                        break;
                    case 8:
                        ActivityArray = Activities8;
                        break;
                    case 9:
                        ActivityArray = Activities9;
                        break;
                }
                for (int j = 0; j < ActivityArray.Length; j++)
                {
                    StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": " + ActivityArray[j], "Activity Status"), "Open");
                }
                driver.SwitchTo().Window(HomeWindow);
            }
        }
        public void ATC3330_CRMInvestigationValidateSubstatusAfterSelectingStatus()
        {
            //Login in as role
            User user = this.environment.GetUser(SecurityRole.Investigations);

            new LoginDialog().Login(user.Id, user.Password);

            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            // Create new investigation case
            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle; //Records the current window handles
            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetStatus("Investigation current");
            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetSubStatus("Conducting background searches");
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickSaveButton();
            string investigationID = investigationCasePage.GetInvestigationCaseNumber();

            // Now close the investigation case
            investigationCasePage.ClickStartDialogButton();
            Table table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Close investigation case", "Created On");
            BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            INVPage iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

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

            // Now Investigation case is closed.. verify that this case is not seen in active Investigation case
            investigationCasePage.ClickSaveButton();

            // RE-OPEN the Investigation Case by running the dialog
            investigationCasePage.ClickStartDialogButton();
            table = new Table(investigationCasePage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "INV: Re-open investigation case", "Created On");
            BaseWindow = driver.CurrentWindowHandle; //Records the current window handle
            investigationCasePage.ClickDialogAddButton();

            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "INV:");

            iNVPage = new INVPage(driver);
            iNVPage.ClickNextButton();
            iNVPage.ClickNextButton();
            iNVPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage.ClickSaveButton();
            // Select any Status and verify that list of "Sub-status" is correctly displayed

            investigationCasePage.SetStatus("Case finalisation");
            investigationCasePage.ClickPageTitle();
            // Verify that Sub-status is cleared off and error message is thrown
            investigationCasePage.ClickSubStatusText();
            StringAssert.Contains(investigationCasePage.GetSubStatusErrorText(), "You must provide a value for Sub Status.");

            investigationCasePage.ClickPageTitle();

            investigationCasePage.ClickSubStatusSearchButton();

            Assert.IsTrue(investigationCasePage.FindSubStatusFromDropdown("Case closed discussion"));
            Assert.IsTrue(investigationCasePage.FindSubStatusFromDropdown("Close without further action"));
            Assert.IsTrue(investigationCasePage.FindSubStatusFromDropdown("Educating respondent(s)"));
            Assert.IsTrue(investigationCasePage.FindSubStatusFromDropdown("Prosecution required"));
            Assert.AreEqual(4, investigationCasePage.GetSubStatusCount());
        }