示例#1
0
        public void GivenIHaveAListOfAllJobProfileWithTitlesAndAlterantiveTitleAsync()
        {
            outputHelper.WriteLine($"Search for * to get all profile");
            try
            {
                var searchResults = searchQueryService.Search("*", new SearchProperties
                {
                    UseRawSearchTerm = true,
                    Count            = 10000
                });

                searchResults.SaveTo(scenarioContext, AllProfileResultList);
                outputHelper.WriteLine($"Got {searchResults.Count} profiles");
            }
            catch (Exception ex)
            {
                outputHelper.WriteLine($"Exception in When:- {ex.ToString()}");
                throw;
            }
        }
示例#2
0
 public void WhenISearchUsingTheSearchTerm(string searchTerm)
 {
     OutputHelper.WriteLine($"The search term is '{searchTerm}'");
     try
     {
         results = searchQueryService.Search(searchTerm);
     }
     catch (Exception ex)
     {
         OutputHelper.WriteLine($"Exception in When:- {ex.ToString()}");
     }
 }
示例#3
0
        public void GetRelatedJobProfilesTest()
        {
            A.CallTo(() => fakeSearchService.Search("*", null)).WithAnyArguments().Returns(DummySearchResults());

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

            //Instantiate
            var jobProfileCategoryRepository = new JobProfileCategoryRepository(fakeSearchService, mapper, fakeTaxonomyRepository);

            var returnedJobProfiles = jobProfileCategoryRepository.GetRelatedJobProfiles("test");

            var expectedResults = DummyJobProfile.GetDummyJobProfiles();

            //Assert
            //The results from search do not include the SOCCode so ignore this
            returnedJobProfiles.Should().BeEquivalentTo(expectedResults, options => options.Excluding(j => j.SOCCode));
            A.CallTo(() => fakeSearchService.Search("*", A <SearchProperties> .That.Matches(x => x.Count.Equals(1000)))).WithAnyArguments().MustHaveHappened();
            A.CallTo(() => fakeTaxonomyRepository.Get(A <Expression <Func <HierarchicalTaxon, bool> > > ._)).MustNotHaveHappened();
            A.CallTo(() => fakeTaxonomyRepository.GetMany(A <Expression <Func <HierarchicalTaxon, bool> > > ._)).MustNotHaveHappened();
        }
        public static SearchResult <JobProfileIndex> FilterByCategory(string category, ISearchQueryService <JobProfileIndex> searchQueryService)
        {
            if (searchQueryService == null)
            {
                throw new ArgumentNullException(nameof(searchQueryService));
            }

            return(searchQueryService.Search(
                       "*",
                       new SearchProperties
            {
                UseRawSearchTerm = true,
                Count = 1000,
                FilterBy = $"{nameof(JobProfileIndex.JobProfileCategories)}/any(c: c eq '{category}')",
                OrderByFields = new string[] { nameof(JobProfileIndex.Title) },
            }));
        }