public void FaqsPageViewModel_search_for_word_returns_expected_two_faqs_in_weight_order_descending() { // Given var faqViewModels = allFaqs.Select(f => new SearchableFaq(f)).ToList(); var expectedFirstFaq = new SearchableFaqViewModel( DlsSubApplication.TrackingSystem, faqViewModels.ElementAt(4) ); var expectedSecondFaq = new SearchableFaqViewModel( DlsSubApplication.TrackingSystem, faqViewModels.ElementAt(1) ); // When var result = new FaqsPageViewModel( DlsSubApplication.TrackingSystem, SupportPage.HelpDocumentation, "currentSystemBaseUrl", faqViewModels, 1, "word" ); // Then var faqs = result.Faqs.ToList(); faqs.Should().HaveCount(2); faqs.ElementAt(0).Should().BeEquivalentTo(expectedFirstFaq); faqs.ElementAt(1).Should().BeEquivalentTo(expectedSecondFaq); }
public IActionResult ViewFaq(DlsSubApplication dlsSubApplication, int faqId) { var faq = faqsService.GetPublishedFaqByIdForTargetGroup(faqId, dlsSubApplication.FaqTargetGroupId !.Value); if (faq == null) { return(NotFound()); } var model = new SearchableFaqViewModel(dlsSubApplication, new SearchableFaq(faq)); return(View(model)); }
public void FaqsPageViewModel_search_for_document_page_two_returns_expected_one_faq() { // Given var faqViewModels = allFaqs.Select(f => new SearchableFaq(f)).ToList(); var expectedFaq = new SearchableFaqViewModel(DlsSubApplication.TrackingSystem, faqViewModels.ElementAt(8)); // When var result = new FaqsPageViewModel( DlsSubApplication.TrackingSystem, SupportPage.HelpDocumentation, "currentSystemBaseUrl", faqViewModels, 2, "document" ); // Then var faqs = result.Faqs.ToList(); faqs.Should().HaveCount(1); faqs.First().Should().BeEquivalentTo(expectedFaq); }