public void SetHtmlContent_TextIsNotFurtherEncoded() { // Arrange var tagHelperContent = new DefaultTagHelperContent(); // Act tagHelperContent.SetHtmlContent("Hi"); // Assert Assert.Equal("Hi", tagHelperContent.GetContent(new CommonTestEncoder())); }
public void SetHtmlContent_TextIsNotFurtherEncoded() { // Arrange var tagHelperContent = new DefaultTagHelperContent(); // Act tagHelperContent.SetHtmlContent("Hi"); // Assert Assert.Equal("Hi", tagHelperContent.GetContent(new HtmlTestEncoder())); }
public void SetHtmlContent_ClearsExistingContent() { // Arrange var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.AppendHtml("Contoso"); // Act tagHelperContent.SetHtmlContent("Hello World!"); // Assert Assert.Equal("Hello World!", tagHelperContent.GetContent(new HtmlTestEncoder())); }
public void SetHtmlContent_ClearsExistingContent() { // Arrange var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.AppendHtml("Contoso"); // Act tagHelperContent.SetHtmlContent("Hello World!"); // Assert Assert.Equal("Hello World!", tagHelperContent.GetContent(new CommonTestEncoder())); }
private static TagHelperOutput GetTagHelperOutput( string tagName = "cache", TagHelperAttributeList attributes = null, string childContent = "some child content") { attributes = attributes ?? new TagHelperAttributeList { { "attr", "value" } }; return new TagHelperOutput( tagName, attributes, getChildContentAsync: useCachedResult => { var tagHelperContent = new DefaultTagHelperContent(); tagHelperContent.SetHtmlContent(childContent); return Task.FromResult<TagHelperContent>(tagHelperContent); }); }