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

            return(retSearchResults);
        }
Exemple #3
0
        //As a Citizen, I want to be able to view the job profiles on the job category page
        public void DFC275ScenarioA1AndA2AndA3AndA4ForJobProfilesByCategory()
        {
            // Arrange
            var indexView = new _MVC_Views_JobProfilesByCategory_Index_cshtml();
            var jobProfileByCategoryViewModel = GenerateJobProfileByCategoryViewModelDummy();

            // Act
            var htmlDom = indexView.RenderAsHtml(jobProfileByCategoryViewModel);

            // Asserts

            //Category title is displayed
            GetH1Heading(htmlDom).Should().BeEquivalentTo(jobProfileByCategoryViewModel.Title);

            //Profiles displayed in alphabetical order - dont think this is the correct place to test this
            var displayedJobProfiles = GetDisplayedJobProfiles(htmlDom);

            //Compare what is displayed Title, Overview and AlernativeTitle only when its there else no h3 element
            displayedJobProfiles.Should().BeEquivalentTo(DummyJobProfile.GetDummyJobProfilesForCategory());
        }
Exemple #4
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();
        }