public async Task MultipleSectionsArticleWithSectionSlugViewDataCanonicalUrlShouldNotBeNull() { const string articleSlug = "physical-activity"; const string sectionSlug = "physical-activity-overview"; var sectionOne = new ProcessedSection("Overview", "physical-activity-overview", string.Empty, "body", new List <Profile>(), new List <Document>(), new List <Alert>()); var sectionTwo = new ProcessedSection("Types of Physical Activity", TextHelper.AnyString, TextHelper.AnyString, "body", new List <Profile>(), new List <Document>(), new List <Alert>()); var article = new ProcessedArticle(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, new List <ProcessedSection>() { sectionOne, sectionTwo }, string.Empty, string.Empty, string.Empty, new List <Crumb>() { }, new List <Alert>(), new NullTopic(), new List <Alert>(), null, new DateTime(), new bool()); var response = new HttpResponse(200, article, string.Empty); _articleRepository.Setup(o => o.Get(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).ReturnsAsync(response); var view = await _controller.ArticleWithSection(articleSlug, sectionSlug, DefaultMessage, "", "") as ViewResult;; view.ViewData["CanonicalUrl"].Should().NotBeNull(); string canonicalUrl = (string)view.ViewData["CanonicalUrl"]; canonicalUrl.Should().Contain("physical-activity"); canonicalUrl.Should().NotContain("physical-activity-overview"); }