Issue #318: Removing Generate*() methods.
This commit is contained in:
parent
36f02690d2
commit
7daec14e49
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// <summary>
|
||||
/// Default concrete <see cref="TagHelperContent"/>.
|
||||
/// </summary>
|
||||
public class DefaultTagHelperContent : TagHelperContent, ITextWriterCopyable
|
||||
public class DefaultTagHelperContent : TagHelperContent
|
||||
{
|
||||
private readonly BufferEntryCollection _buffer;
|
||||
|
||||
|
|
@ -124,15 +124,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
return string.Join(string.Empty, _buffer);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void CopyTo([NotNull] TextWriter writer)
|
||||
{
|
||||
foreach (var value in _buffer)
|
||||
{
|
||||
writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the contract for copying to a <see cref="TextWriter"/>.
|
||||
/// </summary>
|
||||
public interface ITextWriterCopyable
|
||||
{
|
||||
/// <summary>
|
||||
/// Copies to the <paramref name="writer"/>.
|
||||
/// </summary>
|
||||
/// <param name="writer">The <see cref="TextWriter"/> target.</param>
|
||||
void CopyTo(TextWriter writer);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||
{
|
||||
|
|
@ -15,16 +14,13 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// </summary>
|
||||
public class TagHelperOutput
|
||||
{
|
||||
private bool _isTagNameNullOrWhitespace;
|
||||
private string _tagName;
|
||||
private readonly IHtmlEncoder _htmlEncoder;
|
||||
private readonly DefaultTagHelperContent _preContent;
|
||||
private readonly DefaultTagHelperContent _content;
|
||||
private readonly DefaultTagHelperContent _postContent;
|
||||
|
||||
// Internal for testing
|
||||
internal TagHelperOutput(string tagName)
|
||||
: this(tagName, new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase), null)
|
||||
: this(tagName, new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -33,19 +29,15 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// </summary>
|
||||
/// <param name="tagName">The HTML element's tag name.</param>
|
||||
/// <param name="attributes">The HTML attributes.</param>
|
||||
/// <param name="htmlEncoder">The <see cref="IHtmlEncoder"/> used
|
||||
/// to encode HTML attribute values.</param>
|
||||
public TagHelperOutput(
|
||||
string tagName,
|
||||
[NotNull] IDictionary<string, string> attributes,
|
||||
[NotNull] IHtmlEncoder htmlEncoder)
|
||||
[NotNull] IDictionary<string, string> attributes)
|
||||
{
|
||||
TagName = tagName;
|
||||
Attributes = new Dictionary<string, string>(attributes, StringComparer.OrdinalIgnoreCase);
|
||||
_preContent = new DefaultTagHelperContent();
|
||||
_content = new DefaultTagHelperContent();
|
||||
_postContent = new DefaultTagHelperContent();
|
||||
_htmlEncoder = htmlEncoder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -54,18 +46,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// <remarks>
|
||||
/// A whitespace or <c>null</c> value results in no start or end tag being rendered.
|
||||
/// </remarks>
|
||||
public string TagName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _tagName;
|
||||
}
|
||||
set
|
||||
{
|
||||
_tagName = value;
|
||||
_isTagNameNullOrWhitespace = string.IsNullOrWhiteSpace(_tagName);
|
||||
}
|
||||
}
|
||||
public string TagName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The HTML element's pre content.
|
||||
|
|
@ -125,107 +106,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// </summary>
|
||||
public IDictionary<string, string> Attributes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Generates the <see cref="TagHelperOutput"/>'s start tag.
|
||||
/// </summary>
|
||||
/// <returns><c>string.Empty</c> if <see cref="TagName"/> is <c>null</c> or whitespace. Otherwise, the
|
||||
/// <see cref="string"/> representation of the <see cref="TagHelperOutput"/>'s start tag.</returns>
|
||||
public string GenerateStartTag()
|
||||
{
|
||||
// Only render a start tag if the tag name is not whitespace
|
||||
if (_isTagNameNullOrWhitespace)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.Append('<')
|
||||
.Append(TagName);
|
||||
|
||||
foreach (var attribute in Attributes)
|
||||
{
|
||||
var value = _htmlEncoder.HtmlEncode(attribute.Value);
|
||||
sb.Append(' ')
|
||||
.Append(attribute.Key)
|
||||
.Append("=\"")
|
||||
.Append(value)
|
||||
.Append('"');
|
||||
}
|
||||
|
||||
if (SelfClosing)
|
||||
{
|
||||
sb.Append(" /");
|
||||
}
|
||||
|
||||
sb.Append('>');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the <see cref="TagHelperOutput"/>'s <see cref="PreContent"/>.
|
||||
/// </summary>
|
||||
/// <returns><c>null</c> if <see cref="TagName"/> is not <c>null</c> or whitespace
|
||||
/// and <see cref="SelfClosing"/> is <c>true</c>.
|
||||
/// Otherwise, an <see cref="ITextWriterCopyable"/> containing the <see cref="PreContent"/>.</returns>
|
||||
public ITextWriterCopyable GeneratePreContent()
|
||||
{
|
||||
if (!_isTagNameNullOrWhitespace && SelfClosing)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _preContent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the <see cref="TagHelperOutput"/>'s body.
|
||||
/// </summary>
|
||||
/// <returns><c>null</c> if <see cref="TagName"/> is not <c>null</c> or whitespace
|
||||
/// and <see cref="SelfClosing"/> is <c>true</c>.
|
||||
/// Otherwise, an <see cref="ITextWriterCopyable"/> containing the <see cref="Content"/>.</returns>
|
||||
public ITextWriterCopyable GenerateContent()
|
||||
{
|
||||
if (!_isTagNameNullOrWhitespace && SelfClosing)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the <see cref="TagHelperOutput"/>'s <see cref="PostContent"/>.
|
||||
/// </summary>
|
||||
/// <returns><c>null</c> if <see cref="TagName"/> is not <c>null</c> or whitespace
|
||||
/// and <see cref="SelfClosing"/> is <c>true</c>.
|
||||
/// Otherwise, an <see cref="ITextWriterCopyable"/> containing the <see cref="PostContent"/>.</returns>
|
||||
public ITextWriterCopyable GeneratePostContent()
|
||||
{
|
||||
if (!_isTagNameNullOrWhitespace && SelfClosing)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return _postContent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates the <see cref="TagHelperOutput"/>'s end tag.
|
||||
/// </summary>
|
||||
/// <returns><c>string.Empty</c> if <see cref="TagName"/> is <c>null</c> or whitespace. Otherwise, the
|
||||
/// <see cref="string"/> representation of the <see cref="TagHelperOutput"/>'s end tag.</returns>
|
||||
public string GenerateEndTag()
|
||||
{
|
||||
if (SelfClosing || _isTagNameNullOrWhitespace)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, "</{0}>", TagName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes <see cref="TagHelperOutput"/> to generate nothing.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||
{
|
||||
|
|
@ -13,17 +12,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// </summary>
|
||||
public class TagHelperRunner
|
||||
{
|
||||
private readonly IHtmlEncoder _htmlEncoder;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="TagHelperRunner"/>.
|
||||
/// </summary>
|
||||
/// <param name="htmlEncoder">The <see cref="IHtmlEncoder"/> used to encode HTML.</param>
|
||||
public TagHelperRunner([NotNull] IHtmlEncoder htmlEncoder)
|
||||
{
|
||||
_htmlEncoder = htmlEncoder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls the <see cref="ITagHelper.ProcessAsync"/> method on <see cref="ITagHelper"/>s.
|
||||
/// </summary>
|
||||
|
|
@ -40,8 +28,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
executionContext.GetChildContentAsync);
|
||||
var tagHelperOutput = new TagHelperOutput(
|
||||
executionContext.TagName,
|
||||
executionContext.HTMLAttributes,
|
||||
_htmlEncoder)
|
||||
executionContext.HTMLAttributes)
|
||||
{
|
||||
SelfClosing = executionContext.SelfClosing,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@
|
|||
"Microsoft.AspNet.Razor": "4.0.0-*",
|
||||
"Microsoft.Framework.BufferEntryCollection.Internal": { "type": "build", "version": "1.0.0-*" },
|
||||
"Microsoft.Framework.CopyOnWriteDictionary.Internal": { "type": "build", "version": "1.0.0-*" },
|
||||
"Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" },
|
||||
"Microsoft.Framework.WebEncoders.Core": "1.0.0-*"
|
||||
"Microsoft.Framework.NotNullAttribute.Internal": { "type": "build", "version": "1.0.0-*" }
|
||||
},
|
||||
"frameworks": {
|
||||
"net45": { },
|
||||
|
|
|
|||
|
|
@ -75,15 +75,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
if (!_designTimeMode)
|
||||
{
|
||||
RenderRunTagHelpers();
|
||||
|
||||
RenderTagOutput(_tagHelperContext.OutputGenerateStartTagMethodName, methodReturnsString: true);
|
||||
RenderTagOutput(_tagHelperContext.OutputGeneratePreContentMethodName, methodReturnsString: false);
|
||||
|
||||
RenderTagHelperContent();
|
||||
|
||||
RenderTagOutput(_tagHelperContext.OutputGeneratePostContentMethodName, methodReturnsString: false);
|
||||
RenderTagOutput(_tagHelperContext.OutputGenerateEndTagMethodName, methodReturnsString: true);
|
||||
|
||||
RenderWriteTagHelperMethodCall();
|
||||
RenderEndTagHelpersScope();
|
||||
}
|
||||
}
|
||||
|
|
@ -360,71 +352,6 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
}
|
||||
}
|
||||
|
||||
private void RenderTagHelperContent()
|
||||
{
|
||||
_writer.Write("if (")
|
||||
.Write(ExecutionContextVariableName)
|
||||
.Write(".")
|
||||
.Write(_tagHelperContext.ExecutionContextOutputPropertyName)
|
||||
.Write(".")
|
||||
.Write(_tagHelperContext.OutputIsContentModifiedPropertyName)
|
||||
.WriteLine(")");
|
||||
|
||||
// At this point in the codegen, TagHelperOutput.Content is set. We need to use this to render the Content
|
||||
// instead of executing the child content
|
||||
using (_writer.BuildScope())
|
||||
{
|
||||
RenderTagOutput(_tagHelperContext.OutputGenerateContentMethodName, methodReturnsString: false);
|
||||
}
|
||||
|
||||
_writer.Write("else if (")
|
||||
.Write(ExecutionContextVariableName)
|
||||
.Write(".")
|
||||
.Write(_tagHelperContext.ExecutionContextChildContentRetrievedPropertyName)
|
||||
.WriteLine(")");
|
||||
|
||||
// Render the body of the else if statement, at this point in the codegen the GetChildContentAsync method
|
||||
// was invoked but the TagHelperOutput's Content was not set. Call into GetChildContentAsync to retrieve
|
||||
// the cached value of the content so we don't execute the child content twice.
|
||||
using (_writer.BuildScope())
|
||||
{
|
||||
RenderStartWriteMethod();
|
||||
|
||||
_writer.WriteInstanceMethodInvocation(ExecutionContextVariableName,
|
||||
_tagHelperContext.ExecutionContextGetChildContentAsyncMethodName,
|
||||
endLine: false);
|
||||
|
||||
_writer.Write(".Result")
|
||||
.WriteEndMethodInvocation();
|
||||
}
|
||||
|
||||
_writer.WriteLine("else");
|
||||
|
||||
// Render the body of the else statement, at this point in the codegen the GetChildContentAsync method
|
||||
// was not invoked and the TagHelperOutput's Content was not set. Call into ExecuteChildContentAsync to
|
||||
// to execute and render child content.
|
||||
using (_writer.BuildScope())
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_context.TargetWriterName))
|
||||
{
|
||||
_writer.WriteMethodInvocation(
|
||||
_tagHelperContext.StartTagHelperWritingScopeMethodName,
|
||||
_context.TargetWriterName);
|
||||
}
|
||||
|
||||
_writer.WriteInstanceMethodInvocation(
|
||||
ExecutionContextVariableName,
|
||||
_tagHelperContext.ExecutionContextExecuteChildContentAsyncMethodName,
|
||||
endLine: false);
|
||||
_writer.WriteLine(".Wait();");
|
||||
|
||||
if (!string.IsNullOrEmpty(_context.TargetWriterName))
|
||||
{
|
||||
_writer.WriteMethodInvocation(_tagHelperContext.EndTagHelperWritingScopeMethodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RenderEndTagHelpersScope()
|
||||
{
|
||||
_writer.WriteStartAssignment(ExecutionContextVariableName)
|
||||
|
|
@ -432,38 +359,24 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
_tagHelperContext.ScopeManagerEndMethodName);
|
||||
}
|
||||
|
||||
private void RenderTagOutput(string tagOutputMethodName, bool methodReturnsString)
|
||||
{
|
||||
// If its a string WriteLiteral must be generated.
|
||||
if (methodReturnsString)
|
||||
{
|
||||
CSharpCodeVisitor.RenderPreWriteStart(_writer, _context);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderStartWriteMethod();
|
||||
}
|
||||
|
||||
_writer.Write(ExecutionContextVariableName)
|
||||
.Write(".")
|
||||
.Write(_tagHelperContext.ExecutionContextOutputPropertyName)
|
||||
.Write(".")
|
||||
.WriteMethodInvocation(tagOutputMethodName, endLine: false)
|
||||
.WriteEndMethodInvocation();
|
||||
}
|
||||
private void RenderStartWriteMethod()
|
||||
private void RenderWriteTagHelperMethodCall()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_context.TargetWriterName))
|
||||
{
|
||||
_writer
|
||||
.WriteStartMethodInvocation(_context.Host.GeneratedClassContext.WriteToMethodName)
|
||||
.WriteStartMethodInvocation(_tagHelperContext.WriteTagHelperToAsyncMethodName)
|
||||
.Write(_context.TargetWriterName)
|
||||
.WriteParameterSeparator();
|
||||
}
|
||||
else
|
||||
{
|
||||
_writer.WriteStartMethodInvocation(_context.Host.GeneratedClassContext.WriteMethodName);
|
||||
_writer.WriteStartMethodInvocation(_tagHelperContext.WriteTagHelperAsyncMethodName);
|
||||
}
|
||||
|
||||
_writer
|
||||
.Write(ExecutionContextVariableName)
|
||||
.WriteEndMethodInvocation(endLine: false)
|
||||
.WriteLine(".Wait();");
|
||||
}
|
||||
|
||||
private void RenderRunTagHelpers()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
.Write(CSharpTagHelperCodeRenderer.RunnerVariableName)
|
||||
.Write(" ?? ")
|
||||
.WriteStartNewObject(_tagHelperContext.RunnerTypeName)
|
||||
.Write(_tagHelperContext.HtmlEncoderPropertyName)
|
||||
.WriteEndMethodInvocation();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,15 +17,6 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
RunnerRunAsyncMethodName = "RunAsync";
|
||||
ScopeManagerBeginMethodName = "Begin";
|
||||
ScopeManagerEndMethodName = "End";
|
||||
OutputIsContentModifiedPropertyName = "IsContentModified";
|
||||
OutputGenerateStartTagMethodName = "GenerateStartTag";
|
||||
OutputGeneratePreContentMethodName = "GeneratePreContent";
|
||||
OutputGenerateContentMethodName = "GenerateContent";
|
||||
OutputGeneratePostContentMethodName = "GeneratePostContent";
|
||||
OutputGenerateEndTagMethodName = "GenerateEndTag";
|
||||
ExecutionContextChildContentRetrievedPropertyName = "ChildContentRetrieved";
|
||||
ExecutionContextExecuteChildContentAsyncMethodName = "ExecuteChildContentAsync";
|
||||
ExecutionContextGetChildContentAsyncMethodName = "GetChildContentAsync";
|
||||
ExecutionContextAddMethodName = "Add";
|
||||
ExecutionContextAddTagHelperAttributeMethodName = "AddTagHelperAttribute";
|
||||
ExecutionContextAddHtmlAttributeMethodName = "AddHtmlAttribute";
|
||||
|
|
@ -35,8 +26,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
RunnerTypeName = "TagHelperRunner";
|
||||
ScopeManagerTypeName = "TagHelperScopeManager";
|
||||
ExecutionContextTypeName = "TagHelperExecutionContext";
|
||||
HtmlEncoderPropertyName = "HtmlEncoder";
|
||||
TagHelperContentTypeName = "TagHelperContent";
|
||||
WriteTagHelperAsyncMethodName = "WriteTagHelperAsync";
|
||||
WriteTagHelperToAsyncMethodName = "WriteTagHelperToAsync";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -59,52 +51,6 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// </summary>
|
||||
public string ScopeManagerEndMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the property used to determine if a tag helper output's content was set.
|
||||
/// </summary>
|
||||
public string OutputIsContentModifiedPropertyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to generate a tag helper output's start tag.
|
||||
/// </summary>
|
||||
public string OutputGenerateStartTagMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to generate a tag helper output's pre content.
|
||||
/// </summary>
|
||||
public string OutputGeneratePreContentMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to generate a tag helper output's content.
|
||||
/// </summary>
|
||||
public string OutputGenerateContentMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to generate a tag helper output's post-content.
|
||||
/// </summary>
|
||||
public string OutputGeneratePostContentMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to generate a tag helper output's end tag.
|
||||
/// </summary>
|
||||
public string OutputGenerateEndTagMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the <see cref="ExecutionContextTypeName"/> method used to get a
|
||||
/// <see cref="System.Threading.Tasks.Task"/> that executes tag helper child content.
|
||||
/// </summary>
|
||||
public string ExecutionContextChildContentRetrievedPropertyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
public string ExecutionContextExecuteChildContentAsyncMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the <see cref="ExecutionContextTypeName"/> method used to execute and retrieve tag helper
|
||||
/// child content.
|
||||
/// </summary>
|
||||
public string ExecutionContextGetChildContentAsyncMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the <see cref="ExecutionContextTypeName"/> method used to add tag helper attributes.
|
||||
/// </summary>
|
||||
|
|
@ -153,11 +99,6 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// </remarks>
|
||||
public string ExecutionContextTypeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the property used to encode HTML.
|
||||
/// </summary>
|
||||
public string HtmlEncoderPropertyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the type containing tag helper content.
|
||||
/// </summary>
|
||||
|
|
@ -165,5 +106,16 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
/// Contains the data returned by EndTagHelperWriteScope().
|
||||
/// </remarks>
|
||||
public string TagHelperContentTypeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to write <see cref="ExecutionContextTypeName"/>.
|
||||
/// </summary>
|
||||
public string WriteTagHelperAsyncMethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the method used to write <see cref="ExecutionContextTypeName"/> to a specified
|
||||
/// <see cref="System.IO.TextWriter"/>.
|
||||
/// </summary>
|
||||
public string WriteTagHelperToAsyncMethodName { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,6 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
#if !DNXCORE50
|
||||
using Moq;
|
||||
#endif
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||
|
|
@ -316,46 +313,6 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
Assert.True(tagHelperContent.IsEmpty);
|
||||
}
|
||||
|
||||
// CopyTo
|
||||
[Fact]
|
||||
public void CanWriteToTextWriter()
|
||||
{
|
||||
// Arrange
|
||||
var writer = new StringWriter();
|
||||
var tagHelperContent = new DefaultTagHelperContent();
|
||||
var expected = "Hello World!";
|
||||
tagHelperContent.SetContent(expected);
|
||||
|
||||
// Act
|
||||
tagHelperContent.CopyTo(writer);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, writer.ToString());
|
||||
}
|
||||
|
||||
#if !DNXCORE50
|
||||
[Fact]
|
||||
public void CanWriteToTextWriter_MultipleAppends()
|
||||
{
|
||||
// Arrange
|
||||
var writer = new Mock<StringWriter>();
|
||||
writer.CallBase = true;
|
||||
var tagHelperContent = new DefaultTagHelperContent();
|
||||
var text1 = "Hello";
|
||||
var text2 = " World!";
|
||||
var expected = text1 + text2;
|
||||
tagHelperContent.Append(text1);
|
||||
tagHelperContent.Append(text2);
|
||||
|
||||
// Act
|
||||
tagHelperContent.CopyTo(writer.Object);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, writer.Object.ToString());
|
||||
writer.Verify(w => w.Write(It.IsAny<string>()), Times.Exactly(2));
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public void ToString_ReturnsExpectedValue()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.IO;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers.Test
|
||||
{
|
||||
public class NullHtmlEncoder : IHtmlEncoder
|
||||
{
|
||||
public string HtmlEncode(string value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void HtmlEncode(string value, int startIndex, int charCount, TextWriter output)
|
||||
{
|
||||
output.Write(value.Substring(startIndex, charCount));
|
||||
}
|
||||
|
||||
public void HtmlEncode(char[] value, int startIndex, int charCount, TextWriter output)
|
||||
{
|
||||
output.Write(value, startIndex, charCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.IO;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers.Test
|
||||
{
|
||||
public class PseudoHtmlEncoder : IHtmlEncoder
|
||||
{
|
||||
public string HtmlEncode(string value)
|
||||
{
|
||||
return "HtmlEncode[[" + value + "]]";
|
||||
}
|
||||
|
||||
public void HtmlEncode(string value, int startIndex, int charCount, TextWriter output)
|
||||
{
|
||||
output.Write("HtmlEncode[[");
|
||||
output.Write(value.Substring(startIndex, charCount));
|
||||
output.Write("]]");
|
||||
}
|
||||
|
||||
public void HtmlEncode(char[] value, int startIndex, int charCount, TextWriter output)
|
||||
{
|
||||
output.Write("HtmlEncode[[");
|
||||
output.Write(value, startIndex, charCount);
|
||||
output.Write("]]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers.Test;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||
|
|
@ -33,326 +32,45 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateStartTag_ReturnsFullStartTag()
|
||||
{
|
||||
// Arrange
|
||||
var tagHelperOutput = new TagHelperOutput("p", attributes:
|
||||
new Dictionary<string, string>
|
||||
{
|
||||
{ "class", "btn" },
|
||||
{ "something", " spaced " }
|
||||
},
|
||||
htmlEncoder: new NullHtmlEncoder());
|
||||
|
||||
// Act
|
||||
var output = tagHelperOutput.GenerateStartTag();
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<p class=\"btn\" something=\" spaced \">", 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("<p>", 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<string, string>
|
||||
{
|
||||
{ "class", "btn" },
|
||||
{ "something", " spaced " }
|
||||
},
|
||||
htmlEncoder: new NullHtmlEncoder());
|
||||
|
||||
tagHelperOutput.SelfClosing = true;
|
||||
|
||||
// Act
|
||||
var output = tagHelperOutput.GenerateStartTag();
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<p class=\"btn\" something=\" spaced \" />", 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("<p />", 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<string, string>
|
||||
{
|
||||
{ "hello", "world" },
|
||||
},
|
||||
htmlEncoder: new PseudoHtmlEncoder());
|
||||
|
||||
tagHelperOutput.SelfClosing = true;
|
||||
|
||||
// Act
|
||||
var output = tagHelperOutput.GenerateStartTag();
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<p hello=\"HtmlEncode[[world]]\" />", output);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateStartTag_ReturnsNothingIfWhitespaceTagName()
|
||||
{
|
||||
// Arrange
|
||||
var tagHelperOutput = new TagHelperOutput(" ",
|
||||
attributes: new Dictionary<string, string>
|
||||
{
|
||||
{ "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<DefaultTagHelperContent>(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<DefaultTagHelperContent>(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<DefaultTagHelperContent>(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<DefaultTagHelperContent>(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<DefaultTagHelperContent>(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("</p>", 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<DefaultTagHelperContent>(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<DefaultTagHelperContent>(tagHelperOutput.PreContent);
|
||||
Assert.Empty(result.GetContent());
|
||||
result = Assert.IsType<DefaultTagHelperContent>(tagHelperOutput.Content);
|
||||
Assert.Empty(result.GetContent());
|
||||
result = Assert.IsType<DefaultTagHelperContent>(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<DefaultTagHelperContent>(tagHelperOutput.GeneratePreContent());
|
||||
Assert.Empty(result.GetContent());
|
||||
result = Assert.IsType<DefaultTagHelperContent>(tagHelperOutput.GenerateContent());
|
||||
Assert.Empty(result.GetContent());
|
||||
result = Assert.IsType<DefaultTagHelperContent>(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<string, string>
|
||||
{
|
||||
{ originalName, "btn" },
|
||||
},
|
||||
htmlEncoder: new NullHtmlEncoder());
|
||||
});
|
||||
|
||||
// Act
|
||||
tagHelperOutput.Attributes[updateName] = "super button";
|
||||
|
|
|
|||
|
|
@ -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<int>();
|
||||
|
||||
|
|
@ -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("<p Hello=\"HtmlEncode[[World]]\" />", output);
|
||||
}
|
||||
|
||||
private class ExecutableTagHelper : TagHelper
|
||||
{
|
||||
public bool Processed { get; set; }
|
||||
|
|
|
|||
|
|
@ -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-*",
|
||||
|
|
|
|||
|
|
@ -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<div class=\"randomNonTagHelperAttribute\">\r\n ");
|
||||
Instrumentation.EndContext();
|
||||
|
|
@ -36,22 +36,7 @@ namespace TestOutput
|
|||
__PTagHelper = CreateTagHelper<PTagHelper>();
|
||||
__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</div>");
|
||||
|
|
|
|||
|
|
@ -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<THSdiv class=\"randomNonTagHelperAttribute\">\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</THSdiv>");
|
||||
|
|
|
|||
|
|
@ -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<div class=\"randomNonTagHelperAttribute\">\r\n ");
|
||||
Instrumentation.EndContext();
|
||||
|
|
@ -37,22 +37,7 @@ namespace TestOutput
|
|||
__PTagHelper = CreateTagHelper<PTagHelper>();
|
||||
__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</div>");
|
||||
|
|
|
|||
|
|
@ -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<PTagHelper>();
|
||||
__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<PTagHelper>();
|
||||
__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 </div>\r\n");
|
||||
|
|
|
|||
|
|
@ -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<div>\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</div>");
|
||||
|
|
|
|||
|
|
@ -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<div class=\"randomNonTagHelperAttribute\">\r\n <p class=\"Hello World\" ");
|
||||
Instrumentation.EndContext();
|
||||
|
|
@ -62,22 +62,7 @@ Write(DateTime.Now);
|
|||
#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();
|
||||
Instrumentation.BeginContext(231, 18, true);
|
||||
WriteLiteral("\r\n </p>\r\n</div>");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -38,22 +38,7 @@ MyHelper(string val)
|
|||
__NestedTagHelper = CreateTagHelper<NestedTagHelper>();
|
||||
__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 </div>\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<NestedTagHelper>();
|
||||
__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<MyTagHelper>();
|
||||
__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");
|
||||
|
|
|
|||
|
|
@ -54,22 +54,7 @@ namespace TestOutput
|
|||
__NestedTagHelper = CreateTagHelper<NestedTagHelper>();
|
||||
__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 </div>\r\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue