private ActionResult GetJobProfilesByCategoryView(string urlName) { var category = categoryRepo.GetByUrlName(urlName); //if the category does not exist. if (category == null) { return(HttpNotFound()); } var jobProfiles = categoryRepo.GetRelatedJobProfiles(category.Title); var description = Regex.Replace(MetaDescription, @"{jobcategory}", m => category.Title, RegexOptions.IgnoreCase); webAppContext.SetMetaDescription(description); var model = new JobProfileByCategoryViewModel { Title = category.Title, Description = category.Description, JobProfiles = jobProfiles, JobProfileUrl = JobProfileDetailsPage, }; return(View("Index", model)); }
private void SetupCallsAndFakes(bool isValidJobProfile, bool inContentAuthoringSite = false, bool isContentPreviewMode = false) { webAppContextFake = A.Fake <IWebAppContext>(ops => ops.Strict()); jobProfileRepositoryFake = A.Fake <IJobProfileRepository>(ops => ops.Strict()); applicationLoggerFake = A.Fake <IApplicationLogger>(); sitefinityPageFake = A.Fake <ISitefinityPage>(ops => ops.Strict()); mapper = new MapperConfiguration(c => c.AddProfile <JobProfilesAutoMapperProfile>()).CreateMapper(); A.CallTo(() => webAppContextFake.IsContentAuthoringSite).Returns(inContentAuthoringSite); A.CallTo(() => webAppContextFake.IsContentPreviewMode).Returns(isContentPreviewMode); A.CallTo(() => webAppContextFake.SetMetaDescription(A <string> ._)).DoesNothing(); A.CallTo(() => jobProfileRepositoryFake.GetByUrlName(A <string> ._)) .Returns(GetDummyJobProfile(isValidJobProfile)); A.CallTo(() => jobProfileRepositoryFake.GetByUrlNameForPreview(A <string> ._)) .Returns(GetDummyJobProfile(isValidJobProfile)); A.CallTo(() => sitefinityPageFake.GetDefaultJobProfileToUse(A <string> ._)) .Returns(nameof(JobProfile.UrlName)); }