public void ShowMatchingProfileCountOnPageTest(int pageNumber, bool showMatchingProfileCount, bool expectingToShowCount)
        {
            //Setup the fakes and dummies for test
            SetUpFakesAndCalls();
            SetUpStateMangerFakesAndCalls(PreSearchFilterType.Interest, true);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <JobProfilesAutoMapperProfile>();
            });
            var mapper = config.CreateMapper();

            var searchResults = new SearchResult <JobProfileIndex>()
            {
                Count = 5
            };

            A.CallTo(() => fakeBuildSearchFilterService.BuildPreSearchFilters(A <PreSearchFiltersResultsModel> ._, A <Dictionary <string, PreSearchFilterLogicalOperator> > ._)).Returns(nameof(SearchProperties.FilterBy));
            A.CallTo(() => fakeBuildSearchFilterService.GetIndexFieldDefinitions(A <string> .Ignored)).Returns(new List <KeyValuePair <string, PreSearchFilterLogicalOperator> >());
            A.CallTo(() => fakeSearchQueryService.SearchAsync(A <string> ._, A <SearchProperties> ._)).Returns(searchResults);

            //Instantiate & Act
            var preSearchFiltersController =
                new PreSearchFiltersController(loggerFake, mapper, psfRepositoryFactoryFake, fakePsfStateManager, fakeSearchQueryService, fakeBuildSearchFilterService, fakeAsyncHelper, fakeTaxonomyRepository)
            {
                FilterType = PreSearchFilterType.Interest
            };

            preSearchFiltersController.ThisPageNumber      = pageNumber;
            preSearchFiltersController.UsePageProfileCount = showMatchingProfileCount;

            //Act on the index
            var firstVm          = new PsfModel();
            var resultsViewModel = new PsfSearchResultsViewModel
            {
                PreSearchFiltersModel = GeneratePreSEarchFiltersViewModel(PreSearchFilterType.Interest)
            };

            var postFromResultsPageCall = preSearchFiltersController.WithCallTo(c => c.Index(firstVm, resultsViewModel));

            postFromResultsPageCall.ShouldRenderDefaultView().WithModel <PsfModel>(vm =>
            {
                vm.UsePageProfileCount.Should().Be(expectingToShowCount);
            }).AndNoModelErrors();

            if (expectingToShowCount)
            {
                A.CallTo(() => fakeSearchQueryService.SearchAsync(A <string> ._, A <SearchProperties> ._)).MustHaveHappened();
            }
            else
            {
                A.CallTo(() => fakeSearchQueryService.SearchAsync(A <string> ._, A <SearchProperties> ._)).MustNotHaveHappened();
            }
        }
        private async Task <int> GetNumberOfMatches(PsfModel model)
        {
            var fieldDefinitions = buildSearchFilterService.GetIndexFieldDefinitions(IndexFieldOperators);

            preSearchFilterStateManager.RestoreState(model.OptionsSelected);
            var filterState = preSearchFilterStateManager.GetPreSearchFilterState();

            model.Sections = autoMapper.Map <List <PsfSection> >(filterState.Sections);

            var resultsModel = autoMapper.Map <PreSearchFiltersResultsModel>(model);
            var properties   = new SearchProperties
            {
                Page     = 0,
                Count    = 0,
                FilterBy = buildSearchFilterService.BuildPreSearchFilters(resultsModel, fieldDefinitions.ToDictionary(k => k.Key, v => v.Value))
            };
            var results = await searchQueryService.SearchAsync("*", properties);

            return((int)results.Count);
        }