示例#1
0
 private JobProfileByCategoryViewModel GenerateJobProfileByCategoryViewModelDummy()
 {
     return(new JobProfileByCategoryViewModel
     {
         Title = $"dummy{nameof(JobProfileByCategoryViewModel.Title)}",
         Description = $"dummy{nameof(JobProfileByCategoryViewModel.Description)}",
         JobProfiles = DummyJobProfile.GetDummyJobProfiles(),
         JobProfileUrl = "DummyURL",
     });
 }
示例#2
0
        private SearchResult <JobProfileIndex> DummySearchResults()
        {
            var retSearchResults = new SearchResult <JobProfileIndex>()
            {
                Count   = DummyJobProfile.GetDummyJobProfiles().Count(),
                Results = GenerateJobProfileResultItemDummyCollection(DummyJobProfile.GetDummyJobProfiles())
            };

            return(retSearchResults);
        }
示例#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();
        }