Exemple #1
0
        public void SearchModeCategoryNullCategoryiesVisibilityTest()
        {
            ReferenceDataService.Setup(rds => rds.GetCategories());
            var searchUpdate = new searchUpdate();

            var searchViewModel        = Mediator.Index(ApprenticeshipSearchMode.Category).ViewModel;
            var searchResultsViewModel = Mediator.Results(searchViewModel).ViewModel;
            var view = searchUpdate.RenderAsHtml(searchResultsViewModel.VacancySearch);

            view.GetElementbyId("Keywords").ParentNode.Attributes["class"].Value.Contains(" active").Should().BeFalse();
            view.GetElementbyId("Keywords").ParentNode.Attributes["class"].Value.Contains(" tab1").Should().BeTrue();
            view.GetElementbyId("Keywords").ParentNode.Attributes["class"].Value.Contains(" tab2").Should().BeFalse();

            view.GetElementbyId("Location").Should().NotBeNull();
            view.GetElementbyId("Location").ParentNode.Attributes["class"].Value.Contains(" active").Should().BeFalse();
            view.GetElementbyId("Location").ParentNode.Attributes["class"].Value.Contains(" tab1").Should().BeTrue();
            view.GetElementbyId("Location").ParentNode.Attributes["class"].Value.Contains(" tab2").Should().BeFalse();

            view.GetElementbyId("loc-within").Should().NotBeNull();
            view.GetElementbyId("loc-within").ParentNode.Attributes["class"].Value.Contains(" active").Should().BeFalse();
            view.GetElementbyId("loc-within").ParentNode.Attributes["class"].Value.Contains(" tab1").Should().BeTrue();
            view.GetElementbyId("loc-within").ParentNode.Attributes["class"].Value.Contains(" tab2").Should().BeFalse();

            view.GetElementbyId("apprenticeship-level").Should().NotBeNull();
            view.GetElementbyId("apprenticeship-level").ParentNode.Attributes["class"].Value.Contains(" active").Should().BeFalse();
            view.GetElementbyId("apprenticeship-level").ParentNode.Attributes["class"].Value.Contains(" tab1").Should().BeTrue();
            view.GetElementbyId("apprenticeship-level").ParentNode.Attributes["class"].Value.Contains(" tab2").Should().BeFalse();

            view.GetElementbyId("search-button").Should().NotBeNull();
            view.GetElementbyId("search-button").ParentNode.Attributes["class"].Value.Contains(" tab1").Should().BeTrue();
            view.GetElementbyId("search-button").ParentNode.Attributes["class"].Value.Contains(" tab2").Should().BeFalse();
            view.GetElementbyId("search-button").ParentNode.Attributes["class"].Value.Contains(" active").Should().BeFalse();
        }
        public void SearchModeCategoryNullCategoriesVisibilityTest()
        {
            ReferenceDataService.Setup(rds => rds.GetCategories());
            var searchUpdate = new searchUpdate();

            var searchViewModel        = Mediator.Index(null, ApprenticeshipSearchMode.Category, false).ViewModel;
            var searchResultsViewModel = Mediator.Results(null, searchViewModel).ViewModel;
            var view = searchUpdate.RenderAsHtml(searchResultsViewModel.VacancySearch);

            view.GetElementbyId("Keywords").Should().BeNull();
            view.GetElementbyId("Location").Should().NotBeNull();
            view.GetElementbyId("loc-within").Should().NotBeNull();
            view.GetElementbyId("apprenticeship-level").Should().NotBeNull();
            view.GetElementbyId("search-button").Should().NotBeNull();

            var createNewSearchLink = view.GetElementbyId("start-again-link");

            createNewSearchLink.Should().NotBeNull();
            createNewSearchLink.OuterHtml.Should().Contain("SearchMode=Category");
        }
        public void SearchModeKeywordBasicVisibilityTest()
        {
            var searchUpdate = new searchUpdate();

            var searchViewModel        = Mediator.Index(null, ApprenticeshipSearchMode.Keyword, false).ViewModel;
            var searchResultsViewModel = Mediator.Results(null, searchViewModel).ViewModel;
            var view = searchUpdate.RenderAsHtml(searchResultsViewModel.VacancySearch);

            view.GetElementbyId("validation-summary").Should().BeNull();
            view.GetElementbyId("Keywords").Should().NotBeNull();
            view.GetElementbyId("Location").Should().NotBeNull();
            view.GetElementbyId("loc-within").Should().NotBeNull();
            view.GetElementbyId("apprenticeship-level").Should().NotBeNull();
            view.GetElementbyId("search-button").Should().NotBeNull();

            var createNewSearchLink = view.GetElementbyId("start-again-link");

            createNewSearchLink.Should().NotBeNull();
            createNewSearchLink.OuterHtml.Should().Contain("SearchMode=Keyword");
        }