public void Dfc3391IndexViewTests(bool cadReady) { // Arrange var restrictionsView = new _MVC_Views_JobProfileWhatItTakes_Index_cshtml(); var jobProfileWhatItTakesViewModel = new JobProfileWhatItTakesViewModel { Title = "Dummy Title", IsWhatItTakesCadView = cadReady, RestrictionsOtherRequirements = new RestrictionsOtherRequirements { Restrictions = GetRestrictions(cadReady), } }; // Act var htmlDocument = restrictionsView.RenderAsHtml(jobProfileWhatItTakesViewModel); // Assert if (cadReady) { htmlDocument.DocumentNode.Descendants("li").Count().Should() .IsSameOrEqualTo(jobProfileWhatItTakesViewModel.RestrictionsOtherRequirements.Restrictions.Count()); } htmlDocument.DocumentNode.InnerHtml.IndexOf(jobProfileWhatItTakesViewModel.Title, StringComparison.OrdinalIgnoreCase).Should().BeGreaterThan(-1); }
private ActionResult ReturnSectionView() { var model = new JobProfileWhatItTakesViewModel { IsWhatItTakesCadView = CurrentJobProfile.HowToBecomeData.IsHTBCaDReady, Title = MainSectionTitle, SectionId = SectionId, }; model.JobProfileWhatItTakesSkillsViewModel = new JobProfileWhatItTakesSkillsViewModel { UseSkillsFramework = (WebAppContext.IsContentPreviewMode || WebAppContext.IsContentAuthoringSite) ? ShouldUseSkillsFrameworkInPreview : ShouldUseSkillsFrameworkForCitizen, DigitalSkillsLevel = CurrentJobProfile.DigitalSkillsLevel, SkillsSectionIntro = SkillsSectionIntro, PropertyValue = CurrentJobProfile.Skills, TopSectionContent = TopSectionContent, BottomSectionContent = BottomSectionContent, WhatItTakesSectionTitle = WhatItTakesSectionTitle, }; if (model.JobProfileWhatItTakesSkillsViewModel.UseSkillsFramework) { model.JobProfileWhatItTakesSkillsViewModel.WhatItTakesSkills = jobProfileSkillsRepository.GetContextualisedSkillsById(CurrentJobProfile.RelatedSkills.Take(NumberOfSkillsToDisplay)); } if (model.IsWhatItTakesCadView) { model.RestrictionsOtherRequirements = new RestrictionsOtherRequirements { Restrictions = CurrentJobProfile.Restrictions, OtherRequirements = CurrentJobProfile.OtherRequirements, SectionIntro = RestrictionsIntro, SectionTitle = RestrictionsTitle }; } return(View(model)); }