- {
- { "class", "btn" },
- { "something", " spaced " }
- },
- htmlEncoder: new NullHtmlEncoder());
-
- // Act
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Equal("", output);
- }
-
- [Fact]
- public void GenerateStartTag_ReturnsNoAttributeStartTag()
+ public void PreContent_SetContent_ChangesValue()
{
// Arrange
var tagHelperOutput = new TagHelperOutput("p");
+ tagHelperOutput.PreContent.SetContent("Hello World");
- // Act
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Equal("
", output);
+ // Act & Assert
+ Assert.NotNull(tagHelperOutput.PreContent);
+ Assert.NotNull(tagHelperOutput.Content);
+ Assert.NotNull(tagHelperOutput.PostContent);
+ Assert.Equal("Hello World", tagHelperOutput.PreContent.GetContent());
}
[Fact]
- public void GenerateStartTag_ReturnsSelfClosingStartTag_Attributes()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p",
- attributes: new Dictionary
- {
- { "class", "btn" },
- { "something", " spaced " }
- },
- htmlEncoder: new NullHtmlEncoder());
-
- tagHelperOutput.SelfClosing = true;
-
- // Act
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Equal("", output);
- }
-
- [Fact]
- public void GenerateStartTag_ReturnsSelfClosingStartTag_NoAttributes()
+ public void Content_SetContent_ChangesValue()
{
// Arrange
var tagHelperOutput = new TagHelperOutput("p");
+ tagHelperOutput.Content.SetContent("Hello World");
- tagHelperOutput.SelfClosing = true;
-
- // Act
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Equal("", output);
+ // Act & Assert
+ Assert.NotNull(tagHelperOutput.PreContent);
+ Assert.NotNull(tagHelperOutput.Content);
+ Assert.NotNull(tagHelperOutput.PostContent);
+ Assert.Equal("Hello World", tagHelperOutput.Content.GetContent());
}
[Fact]
- public void GenerateStartTag_UsesProvidedHtmlEncoder()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p",
- attributes: new Dictionary
- {
- { "hello", "world" },
- },
- htmlEncoder: new PseudoHtmlEncoder());
-
- tagHelperOutput.SelfClosing = true;
-
- // Act
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Equal("", output);
- }
-
- [Fact]
- public void GenerateStartTag_ReturnsNothingIfWhitespaceTagName()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput(" ",
- attributes: new Dictionary
- {
- { "class", "btn" },
- { "something", " spaced " }
- },
- htmlEncoder: new NullHtmlEncoder())
- {
- SelfClosing = true
- };
-
- // Act
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Empty(output);
- }
-
-
- [Fact]
- public void GenerateEndTag_ReturnsNothingIfWhitespaceTagName()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput(" ");
- tagHelperOutput.Content.Append("Hello World");
-
- // Act
- var output = tagHelperOutput.GenerateEndTag();
-
- // Assert
- Assert.Empty(output);
- }
-
- [Fact]
- public void GeneratePreContent_ReturnsPreContent()
+ public void PostContent_SetContent_ChangesValue()
{
// Arrange
var tagHelperOutput = new TagHelperOutput("p");
- tagHelperOutput.PreContent.Append("Hello World");
+ tagHelperOutput.PostContent.SetContent("Hello World");
- // Act
- var output = tagHelperOutput.GeneratePreContent();
-
- // Assert
- var result = Assert.IsType(output);
- Assert.Equal("Hello World", result.GetContent());
- }
-
- [Fact]
- public void GeneratePreContent_ReturnsNothingIfSelfClosingWhenTagNameIsNotNullOrWhitespace()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p")
- {
- SelfClosing = true
- };
- tagHelperOutput.PreContent.Append("Hello World");
-
- // Act
- var output = tagHelperOutput.GeneratePreContent();
-
- // Assert
- Assert.Null(output);
- }
-
- [Theory]
- [InlineData(null, true)]
- [InlineData("\t", true )]
- [InlineData(null, false)]
- [InlineData("\t", false)]
- public void GeneratePreContent_ReturnsPreContentIfTagNameIsNullOrWhitespace(string tagName, bool selfClosing)
- {
- // Arrange
- var expectedContent = "Hello World";
-
- var tagHelperOutput = new TagHelperOutput(tagName)
- {
- SelfClosing = selfClosing
- };
- tagHelperOutput.PreContent.Append(expectedContent);
-
- // Act
- var output = tagHelperOutput.GeneratePreContent();
-
- // Assert
- var result = Assert.IsType(output);
- Assert.Equal(expectedContent, result.GetContent());
- }
-
- [Fact]
- public void GenerateContent_ReturnsContent()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p");
- tagHelperOutput.Content.Append("Hello World");
-
- // Act
- var output = tagHelperOutput.GenerateContent();
-
- // Assert
- var result = Assert.IsType(output);
- Assert.Equal("Hello World", result.GetContent());
- }
-
-
- [Fact]
- public void GenerateContent_ReturnsNothingIfSelfClosingWhenTagNameIsNotNullOrWhitespace()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p")
- {
- SelfClosing = true
- };
- tagHelperOutput.Content.Append("Hello World");
-
- // Act
- var output = tagHelperOutput.GenerateContent();
-
- // Assert
- Assert.Null(output);
- }
-
- [Theory]
- [InlineData(null, true)]
- [InlineData("\t", true )]
- [InlineData(null, false)]
- [InlineData("\t", false)]
- public void GenerateContent_ReturnsContentIfTagNameIsNullOrWhitespace(string tagName, bool selfClosing)
- {
- // Arrange
- var expectedContent = "Hello World";
-
- var tagHelperOutput = new TagHelperOutput(tagName)
- {
- SelfClosing = selfClosing
- };
- tagHelperOutput.Content.Append(expectedContent);
-
- // Act
- var output = tagHelperOutput.GenerateContent();
-
- // Assert
- var result = Assert.IsType(output);
- Assert.Equal(expectedContent, result.GetContent());
- }
-
- [Fact]
- public void GeneratePostContent_ReturnsPostContent()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p");
- tagHelperOutput.PostContent.Append("Hello World");
-
- // Act
- var output = tagHelperOutput.GeneratePostContent();
-
- // Assert
- var result = Assert.IsType(output);
- Assert.Equal("Hello World", result.GetContent());
- }
-
- [Fact]
- public void GeneratePostContent_ReturnsNothingIfSelfClosingWhenTagNameIsNotNullOrWhitespace()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p")
- {
- SelfClosing = true
- };
- tagHelperOutput.PostContent.Append("Hello World");
-
- // Act
- var output = tagHelperOutput.GeneratePostContent();
-
- // Assert
- Assert.Null(output);
- }
-
- [Fact]
- public void GenerateEndTag_ReturnsEndTag()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p");
-
- // Act
- var output = tagHelperOutput.GenerateEndTag();
-
- // Assert
- Assert.Equal("
", output);
- }
-
- [Theory]
- [InlineData(null, true)]
- [InlineData("\t", true )]
- [InlineData(null, false)]
- [InlineData("\t", false)]
- public void GeneratePostContent_ReturnsPostContentIfTagNameIsNullOrWhitespace(string tagName, bool selfClosing)
- {
- // Arrange
- var expectedContent = "Hello World";
-
- var tagHelperOutput = new TagHelperOutput(tagName)
- {
- SelfClosing = selfClosing
- };
- tagHelperOutput.PostContent.Append(expectedContent);
-
- // Act
- var output = tagHelperOutput.GeneratePostContent();
-
- // Assert
- var result = Assert.IsType(output);
- Assert.Equal(expectedContent, result.GetContent());
- }
-
- [Fact]
- public void GenerateEndTag_ReturnsNothingIfSelfClosing()
- {
- // Arrange
- var tagHelperOutput = new TagHelperOutput("p")
- {
- SelfClosing = true
- };
-
- // Act
- var output = tagHelperOutput.GenerateEndTag();
-
- // Assert
- Assert.Empty(output);
+ // Act & Assert
+ Assert.NotNull(tagHelperOutput.PreContent);
+ Assert.NotNull(tagHelperOutput.Content);
+ Assert.NotNull(tagHelperOutput.PostContent);
+ Assert.Equal("Hello World", tagHelperOutput.PostContent.GetContent());
}
[Fact]
@@ -369,12 +87,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
// Assert
Assert.Null(tagHelperOutput.TagName);
- var result = Assert.IsType(tagHelperOutput.PreContent);
- Assert.Empty(result.GetContent());
- result = Assert.IsType(tagHelperOutput.Content);
- Assert.Empty(result.GetContent());
- result = Assert.IsType(tagHelperOutput.PostContent);
- Assert.Empty(result.GetContent());
+ Assert.NotNull(tagHelperOutput.PreContent);
+ Assert.Empty(tagHelperOutput.PreContent.GetContent());
+ Assert.NotNull(tagHelperOutput.Content);
+ Assert.Empty(tagHelperOutput.Content.GetContent());
+ Assert.NotNull(tagHelperOutput.PostContent);
+ Assert.Empty(tagHelperOutput.PostContent.GetContent());
}
[Fact]
@@ -386,8 +104,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
{ "class", "btn" },
{ "something", " spaced " }
- },
- htmlEncoder: new NullHtmlEncoder());
+ });
tagHelperOutput.PreContent.Append("Pre Content");
tagHelperOutput.Content.Append("Content");
tagHelperOutput.PostContent.Append("Post Content");
@@ -396,14 +113,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
tagHelperOutput.SuppressOutput();
// Assert
- Assert.Empty(tagHelperOutput.GenerateStartTag());
- var result = Assert.IsType(tagHelperOutput.GeneratePreContent());
- Assert.Empty(result.GetContent());
- result = Assert.IsType(tagHelperOutput.GenerateContent());
- Assert.Empty(result.GetContent());
- result = Assert.IsType(tagHelperOutput.GeneratePostContent());
- Assert.Empty(result.GetContent());
- Assert.Empty(tagHelperOutput.GenerateEndTag());
+ Assert.NotNull(tagHelperOutput.PreContent);
+ Assert.Empty(tagHelperOutput.PreContent.GetContent());
+ Assert.NotNull(tagHelperOutput.Content);
+ Assert.Empty(tagHelperOutput.Content.GetContent());
+ Assert.NotNull(tagHelperOutput.PostContent);
+ Assert.Empty(tagHelperOutput.PostContent.GetContent());
}
[Theory]
@@ -417,8 +132,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
attributes: new Dictionary
{
{ originalName, "btn" },
- },
- htmlEncoder: new NullHtmlEncoder());
+ });
// Act
tagHelperOutput.Attributes[updateName] = "super button";
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperRunnerTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperRunnerTest.cs
index 6bb8296178..499452d490 100644
--- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperRunnerTest.cs
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperRunnerTest.cs
@@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
-using Microsoft.AspNet.Razor.Runtime.TagHelpers.Test;
using Xunit;
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
@@ -62,7 +61,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
int[] expectedTagHelperOrders)
{
// Arrange
- var runner = new TagHelperRunner(new NullHtmlEncoder());
+ var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", selfClosing: false);
var processOrder = new List();
@@ -88,7 +87,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
public async Task RunAsync_SetTagHelperOutputSelfClosing(bool selfClosing)
{
// Arrange
- var runner = new TagHelperRunner(new NullHtmlEncoder());
+ var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", selfClosing);
var tagHelper = new TagHelperContextTouchingTagHelper();
@@ -106,7 +105,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
public async Task RunAsync_ProcessesAllTagHelpers()
{
// Arrange
- var runner = new TagHelperRunner(new NullHtmlEncoder());
+ var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", selfClosing: false);
var executableTagHelper1 = new ExecutableTagHelper();
var executableTagHelper2 = new ExecutableTagHelper();
@@ -125,7 +124,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
public async Task RunAsync_AllowsModificationOfTagHelperOutput()
{
// Arrange
- var runner = new TagHelperRunner(new NullHtmlEncoder());
+ var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", selfClosing: false);
var executableTagHelper = new ExecutableTagHelper();
@@ -145,7 +144,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
public async Task RunAsync_AllowsDataRetrievalFromTagHelperContext()
{
// Arrange
- var runner = new TagHelperRunner(new NullHtmlEncoder());
+ var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", selfClosing: false);
var tagHelper = new TagHelperContextTouchingTagHelper();
@@ -162,7 +161,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
public async Task RunAsync_ConfiguresTagHelperContextWithExecutionContextsItems()
{
// Arrange
- var runner = new TagHelperRunner(new NullHtmlEncoder());
+ var runner = new TagHelperRunner();
var executionContext = new TagHelperExecutionContext("p", selfClosing: false);
var tagHelper = new ContextInspectingTagHelper();
executionContext.Add(tagHelper);
@@ -175,22 +174,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
Assert.Same(tagHelper.ContextProcessedWith.Items, executionContext.Items);
}
- [Fact]
- public async Task RunAsync_CreatesTagHelperOutput_WithProvidedEncoder()
- {
- // Arrange
- var runner = new TagHelperRunner(new PseudoHtmlEncoder());
- var executionContext = new TagHelperExecutionContext("p", selfClosing: true);
- executionContext.AddHtmlAttribute("Hello", "World");
-
- // Act
- var tagHelperOutput = await runner.RunAsync(executionContext);
- var output = tagHelperOutput.GenerateStartTag();
-
- // Assert
- Assert.Equal("", output);
- }
-
private class ExecutableTagHelper : TagHelper
{
public bool Processed { get; set; }
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/project.json b/test/Microsoft.AspNet.Razor.Runtime.Test/project.json
index 9ddaed1335..1e7e17a924 100644
--- a/test/Microsoft.AspNet.Razor.Runtime.Test/project.json
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/project.json
@@ -9,11 +9,7 @@
"test": "xunit.runner.aspnet"
},
"frameworks": {
- "dnx451": {
- "dependencies": {
- "Moq": "4.2.1312.1622"
- }
- },
+ "dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs
index 4186815163..41d1f138c8 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs
@@ -24,7 +24,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(33, 49, true);
WriteLiteral("\r\n\r\n ");
Instrumentation.EndContext();
@@ -36,22 +36,7 @@ namespace TestOutput
__PTagHelper = CreateTagHelper
();
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => {
@@ -65,22 +50,7 @@ namespace TestOutput
__tagHelperExecutionContext.Add(__InputTagHelper2);
__InputTagHelper2.Type = __InputTagHelper.Type;
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => {
@@ -100,22 +70,7 @@ namespace TestOutput
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -124,22 +79,7 @@ namespace TestOutput
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute("class", "Hello World");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(212, 8, true);
WriteLiteral("\r\n ");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.cs
index 71b1a04cbc..402e864d64 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.Prefixed.cs
@@ -25,7 +25,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(57, 52, true);
WriteLiteral("\r\n\r\n ");
Instrumentation.EndContext();
@@ -48,22 +48,7 @@ namespace TestOutput
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -72,22 +57,7 @@ namespace TestOutput
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute("class", "Hello World");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(249, 11, true);
WriteLiteral("\r\n");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.cs
index a4dfe83901..18527be872 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/BasicTagHelpers.cs
@@ -25,7 +25,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(33, 49, true);
WriteLiteral("\r\n\r\n ");
Instrumentation.EndContext();
@@ -37,22 +37,7 @@ namespace TestOutput
__PTagHelper = CreateTagHelper
();
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => {
@@ -66,22 +51,7 @@ namespace TestOutput
__tagHelperExecutionContext.Add(__InputTagHelper2);
__InputTagHelper2.Type = __InputTagHelper.Type;
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => {
@@ -101,22 +71,7 @@ namespace TestOutput
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -125,22 +80,7 @@ namespace TestOutput
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.AddHtmlAttribute("class", "Hello World");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(212, 8, true);
WriteLiteral("\r\n ");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.cs
index b191f07523..ad6f6f7ce4 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/ComplexTagHelpers.cs
@@ -25,7 +25,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(33, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
@@ -72,44 +72,14 @@ namespace TestOutput
__tagHelperExecutionContext.AddHtmlAttribute("value", "");
__tagHelperExecutionContext.AddHtmlAttribute("placeholder", "Enter in a new time...");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
}
, StartTagHelperWritingScope, EndTagHelperWritingScope);
__PTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n");
#line 13 "ComplexTagHelpers.cshtml"
@@ -147,44 +117,14 @@ Write(checkbox);
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
}
, StartTagHelperWritingScope, EndTagHelperWritingScope);
__PTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__PTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => {
@@ -205,22 +145,7 @@ Write(true ? "checkbox" : "anything");
__tagHelperExecutionContext.Add(__InputTagHelper2);
__InputTagHelper2.Type = __InputTagHelper.Type;
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => {
@@ -256,22 +181,7 @@ if(true) {
__tagHelperExecutionContext.Add(__InputTagHelper2);
__InputTagHelper2.Type = __InputTagHelper.Type;
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n");
#line 19 "ComplexTagHelpers.cshtml"
@@ -295,22 +205,7 @@ Write(DateTime.Now);
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
__tagHelperExecutionContext.AddHtmlAttribute("time", __tagHelperStringValueBuffer.ToString());
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(672, 10, true);
WriteLiteral("\r\n ");
@@ -344,22 +239,7 @@ __InputTagHelper2.Checked = @object;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -373,22 +253,7 @@ __PTagHelper.Age = DateTimeOffset.Now.Year - 1970;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(819, 10, true);
WriteLiteral("\r\n ");
@@ -409,22 +274,7 @@ __InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -438,22 +288,7 @@ __PTagHelper.Age = -1970 + DateTimeOffset.Now.Year;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(952, 10, true);
WriteLiteral("\r\n ");
@@ -474,22 +309,7 @@ __InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -503,22 +323,7 @@ __PTagHelper.Age = DateTimeOffset.Now.Year - 1970;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(1080, 10, true);
WriteLiteral("\r\n ");
@@ -539,22 +344,7 @@ __InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014 ;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -568,22 +358,7 @@ __PTagHelper.Age = "My age is this long.".Length;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(1223, 14, true);
WriteLiteral("\r\n \r\n");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs
index ff01872b87..b1036b8f6b 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EmptyAttributeTagHelpers.cs
@@ -25,7 +25,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(27, 13, true);
WriteLiteral("\r\n\r\n ");
Instrumentation.EndContext();
@@ -47,22 +47,7 @@ __InputTagHelper2.Checked = ;
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.AddHtmlAttribute("class", "");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(74, 6, true);
WriteLiteral("\r\n ");
@@ -87,22 +72,7 @@ __InputTagHelper2.Checked = ;
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
__tagHelperExecutionContext.AddHtmlAttribute("class", "");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -116,22 +86,7 @@ __PTagHelper.Age = ;
#line hidden
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(144, 8, true);
WriteLiteral("\r\n
");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.cs
index da8ec326db..033450f381 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/EscapedTagHelpers.cs
@@ -24,7 +24,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(27, 72, true);
WriteLiteral("\r\n");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.cs
index 5da65e0fec..f17063a6aa 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/SingleTagHelper.cs
@@ -23,7 +23,7 @@ namespace TestOutput
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(33, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
@@ -41,22 +41,7 @@ namespace TestOutput
__tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age);
__tagHelperExecutionContext.AddHtmlAttribute("class", "Hello World");
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
}
#pragma warning restore 1998
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInHelper.cs
index 7a9682d40f..2cb75d6991 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInHelper.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInHelper.cs
@@ -38,22 +38,7 @@ MyHelper(string val)
__NestedTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__NestedTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -80,24 +65,7 @@ Write(DateTime.Now);
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
__tagHelperExecutionContext.AddHtmlAttribute("unboundproperty", __tagHelperStringValueBuffer.ToString());
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteralTo(__razor_helper_writer, __tagHelperExecutionContext.Output.GenerateStartTag());
- WriteTo(__razor_helper_writer, __tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- WriteTo(__razor_helper_writer, __tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- WriteTo(__razor_helper_writer, __tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- StartTagHelperWritingScope(__razor_helper_writer);
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- EndTagHelperWritingScope();
- }
- WriteTo(__razor_helper_writer, __tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteralTo(__razor_helper_writer, __tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperToAsync(__razor_helper_writer, __tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(342, 14, true);
WriteLiteralTo(__razor_helper_writer, "\r\n \r\n");
@@ -132,7 +100,7 @@ Write(DateTime.Now);
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
- __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(HtmlEncoder);
+ __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner();
Instrumentation.BeginContext(33, 2, true);
WriteLiteral("\r\n");
Instrumentation.EndContext();
@@ -146,24 +114,7 @@ Write(MyHelper(item => new Template((__razor_template_writer) => {
__NestedTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__NestedTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateStartTag());
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- StartTagHelperWritingScope(__razor_template_writer);
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- EndTagHelperWritingScope();
- }
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperToAsync(__razor_template_writer, __tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
}
)
@@ -176,22 +127,7 @@ Write(MyHelper(item => new Template((__razor_template_writer) => {
__MyTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__MyTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(445, 2, true);
WriteLiteral("\r\n");
diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInSection.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInSection.cs
index 31387a6e04..4ed70ec2c7 100644
--- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInSection.cs
+++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/CS/Output/TagHelpersInSection.cs
@@ -54,22 +54,7 @@ namespace TestOutput
__NestedTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__NestedTagHelper);
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag());
- Write(__tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- Write(__tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- Write(__tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- }
- Write(__tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperAsync(__tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
WriteLiteral("\r\n ");
}
@@ -96,24 +81,7 @@ Write(DateTime.Now);
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
__tagHelperExecutionContext.AddHtmlAttribute("unboundproperty", __tagHelperStringValueBuffer.ToString());
__tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result;
- WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateStartTag());
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output.GeneratePreContent());
- if (__tagHelperExecutionContext.Output.IsContentModified)
- {
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateContent());
- }
- else if (__tagHelperExecutionContext.ChildContentRetrieved)
- {
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.GetChildContentAsync().Result);
- }
- else
- {
- StartTagHelperWritingScope(__razor_template_writer);
- __tagHelperExecutionContext.ExecuteChildContentAsync().Wait();
- EndTagHelperWritingScope();
- }
- WriteTo(__razor_template_writer, __tagHelperExecutionContext.Output.GeneratePostContent());
- WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateEndTag());
+ WriteTagHelperToAsync(__razor_template_writer, __tagHelperExecutionContext).Wait();
__tagHelperExecutionContext = __tagHelperScopeManager.End();
Instrumentation.BeginContext(359, 14, true);
WriteLiteralTo(__razor_template_writer, "\r\n \r\n");