public void ATC3284_CRMEntityAllegedOffenceBeliefDateblankedStatusReasonreverts()
        {
            string allegedoffenceId;
            string todayDate = DateTime.Now.ToString("d/MM/yyyy");
            string investigationID;

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

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

            InvestigationCaseSearchPage investigationCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationCaseSearchPage.ClickNewInvestigationCaseButton();

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

            homePageInvestigation.HoverCRMRibbonTab();
            homePageInvestigation.ClickInvestigationsRibbonButton();
            homePageInvestigation.HoverInvestigationsRibbonTab();
            homePageInvestigation.ClickRightScrollRibbonButton();
            homePageInvestigation.ClickAllegedOffencesButton();

            AllegendOffensesSearchPage allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);

            allegedOffencesSearchPage.ClickNewAllegedOffenceButton();

            AllegedOffencePage allegedOffencesPage = new AllegedOffencePage(driver);
            allegedOffencesPage.SetInvestigationCaseValue(investigationID);
            allegedOffencesPage.SetProvisionValue("RTRA 116(1)");
            allegedOffencesPage.SetOffenceDateValue("1/01/2015");
            allegedOffencesPage.SetBeliefFormedDateValue(todayDate);
            allegedOffencesPage.ClickSaveButton();
            allegedoffenceId = allegedOffencesPage.GetReferenceNumber();
            allegedOffencesPage.ClickSaveCloseButton();

            allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);
            allegedOffencesSearchPage.SetInvestigationSearchText(investigationID);
            Table table = new Table(allegedOffencesSearchPage.GetSearchResultTable());
            table.SelectTableRow("Status Reason", "Belief");

            allegedOffencesPage = new AllegedOffencePage(driver);
            allegedOffencesPage.SetOffenceDateValue("");
            StringAssert.Contains(allegedOffencesPage.GetOffenceDateValue(),"--");
            allegedOffencesPage.SetBeliefFormedDateValue("");
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Suspicion");

            allegedoffenceId = allegedOffencesPage.GetReferenceNumber();
            allegedOffencesPage.ClickSaveCloseButton();

            allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);
            allegedOffencesSearchPage.SetInvestigationSearchText(allegedoffenceId);
            table = new Table(allegedOffencesSearchPage.GetSearchResultTable());
            table.SelectContainsTableRow("Investigation Case", investigationID);

            allegedOffencesPage = new AllegedOffencePage(driver);
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Suspicion");
            StringAssert.Contains(allegedOffencesPage.GetOffenceDateValue(), "--");
            StringAssert.Contains(allegedOffencesPage.GetStatutoryLimitationValue(), "--");

            allegedOffencesPage.SetOffenceDateValue("01/01/2015");
            allegedOffencesPage.ClickSaveButton();

            StringAssert.Contains(allegedOffencesPage.GetStatutoryLimitationValue(), "1/01/2016");

            StringAssert.Contains(allegedOffencesPage.GetBefliefFormedDateValue(),"");
        }
        public void ATC3340_CRMInvestigationAllegedOffenseStatusChangesToBelief()
        {
            User user = this.environment.GetUser(SecurityRole.InvestigationsOfficer);
            new LoginDialog().Login(user.Id, user.Password);

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

            InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.ClickNewInvestigationCaseButton();

            // Create new case and validate Status and Substatus fields
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            investigationCasePage.ClickSaveButton();
            String investigationID = investigationCasePage.GetInvestigationCaseNumber();
            investigationCasePage.ClickSaveCloseButton();

            driver = driver.SwitchTo().Window(HomeWindow);
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickRightScrollRibbonButton();
            homePage.ClickAllegedOffencesButton();

            AllegendOffensesSearchPage allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);

            allegedOffencesSearchPage.ClickNewAllegedOffenceButton();

            AllegedOffencePage allegedOffencesPage = new AllegedOffencePage(driver);
            allegedOffencesPage.SetInvestigationCaseValue(investigationID);
            allegedOffencesPage.SetProvisionValue("RTRA 116(1)");
            allegedOffencesPage.ClickSaveButton();
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Suspicion");

            string OffenceDate = DateTime.Now.AddYears(-1).ToString("d/MM/yyyy");
            allegedOffencesPage.SetOffenceDateValue(OffenceDate);
            string todaysDate = DateTime.Now.ToString("d/MM/yyyy");
            allegedOffencesPage.SetBeliefFormedDateValue(todaysDate);
            allegedOffencesPage.ClickSaveButton();

            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Belief");
            string StatutoryDate = allegedOffencesPage.GetStatutoryLimitationValue();
            string allegedoffenceId = allegedOffencesPage.GetReferenceNumber();
            allegedOffencesPage.ClickSaveCloseButton();

            allegedOffencesSearchPage = new AllegendOffensesSearchPage(driver);
            allegedOffencesSearchPage.SetInvestigationSearchText(investigationID);
            Table table = new Table(allegedOffencesSearchPage.GetSearchResultTable());
            table.SelectTableRow("Status Reason", "Belief");

            allegedOffencesPage = new AllegedOffencePage(driver);
            StringAssert.Contains(allegedOffencesPage.GetStatusReason(), "Belief");
            StringAssert.Contains(allegedOffencesPage.GetStatutoryLimitationValue(), StatutoryDate);
            StringAssert.Contains(allegedOffencesPage.GetBefliefFormedDateValue(), todaysDate);
        }