public void SuppressOutput_PreventsTagOutput() { // Arrange var tagHelperOutput = new TagHelperOutput("p", attributes: new Dictionary<string, string> { { "class", "btn" }, { "something", " spaced " } }) { PreContent = "Pre Content", Content = "Content", PostContent = "Post Content" }; // Act tagHelperOutput.SuppressOutput(); // Assert Assert.Empty(tagHelperOutput.GenerateStartTag()); Assert.Null(tagHelperOutput.GeneratePreContent()); Assert.Null(tagHelperOutput.GenerateContent()); Assert.Null(tagHelperOutput.GeneratePostContent()); Assert.Empty(tagHelperOutput.GenerateEndTag()); }
public void GenerateContent_ReturnsContent() { // Arrange var tagHelperOutput = new TagHelperOutput("p"); tagHelperOutput.Content = "Hello World"; // Act var output = tagHelperOutput.GenerateContent(); // Assert Assert.Equal("Hello World", output); }
public void GenerateContent_ReturnsNothingIfSelfClosing() { // Arrange var tagHelperOutput = new TagHelperOutput("p") { SelfClosing = true, Content = "Hello World" }; // Act var output = tagHelperOutput.GenerateContent(); // Assert Assert.Empty(output); }