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 GenerateStartTag_ReturnsNoAttributeStartTag() { // Arrange var tagHelperOutput = new TagHelperOutput("p"); // Act var output = tagHelperOutput.GenerateStartTag(); // Assert Assert.Equal("<p>", output); }
public void GenerateStartTag_ReturnsSelfClosingStartTag_NoAttributes() { // Arrange var tagHelperOutput = new TagHelperOutput("p"); tagHelperOutput.SelfClosing = true; // Act var output = tagHelperOutput.GenerateStartTag(); // Assert Assert.Equal("<p />", output); }
public void GenerateStartTag_ReturnsFullStartTag() { // Arrange var tagHelperOutput = new TagHelperOutput("p", attributes: new Dictionary<string, string> { { "class", "btn" }, { "something", " spaced " } }); // Act var output = tagHelperOutput.GenerateStartTag(); // Assert Assert.Equal("<p class=\"btn\" something=\" spaced \">", output); }
public void GenerateStartTag_ReturnsNothingIfWhitespaceTagName() { // Arrange var tagHelperOutput = new TagHelperOutput(" ", attributes: new Dictionary <string, string> { { "class", "btn" }, { "something", " spaced " } }); tagHelperOutput.SelfClosing = true; // Act var output = tagHelperOutput.GenerateStartTag(); // Assert Assert.Empty(output); }