示例#1
0
        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());
        }
示例#2
0
        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);
        }
示例#3
0
        public void GenerateContent_ReturnsNothingIfSelfClosing()
        {
            // Arrange
            var tagHelperOutput = new TagHelperOutput("p")
            {
                SelfClosing = true,
                Content = "Hello World"
            };

            // Act
            var output = tagHelperOutput.GenerateContent();

            // Assert
            Assert.Empty(output);
        }