public async Task RunAsync_AllowsDataRetrievalFromTagHelperContext() { // Arrange var runner = new TagHelperRunner(); var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var tagHelper = new TagHelperContextTouchingTagHelper(); // Act executionContext.Add(tagHelper); executionContext.AddTagHelperAttribute("foo", true, HtmlAttributeValueStyle.DoubleQuotes); await runner.RunAsync(executionContext); // Assert Assert.Equal("True", executionContext.Output.Attributes["foo"].Value); }
public async Task RunAsync_SetsTagHelperOutputTagMode(TagMode tagMode) { // Arrange var runner = new TagHelperRunner(); var executionContext = new TagHelperExecutionContext("p", tagMode); var tagHelper = new TagHelperContextTouchingTagHelper(); executionContext.Add(tagHelper); executionContext.AddTagHelperAttribute("foo", true, HtmlAttributeValueStyle.DoubleQuotes); // Act await runner.RunAsync(executionContext); // Assert Assert.Equal(tagMode, executionContext.Output.TagMode); }
public async Task RunAsync_ConfiguresTagHelperContextWithExecutionContextsItems() { // Arrange var runner = new TagHelperRunner(); var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var tagHelper = new ContextInspectingTagHelper(); executionContext.Add(tagHelper); // Act await runner.RunAsync(executionContext); // Assert Assert.NotNull(tagHelper.ContextProcessedWith); Assert.Same(tagHelper.ContextProcessedWith.Items, executionContext.Items); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); Instrumentation.BeginContext(27, 72, true); WriteLiteral("\r\n<div class=\"randomNonTagHelperAttribute\">\r\n <p class=\"Hello World\" "); Instrumentation.EndContext(); Instrumentation.BeginContext(102, 12, false); #line 4 "EscapedTagHelpers.cshtml" Write(DateTime.Now); #line default #line hidden Instrumentation.EndContext(); Instrumentation.BeginContext(114, 69, true); WriteLiteral(">\r\n <input type=\"text\" />\r\n <em>Not a TagHelper: </em> "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", true, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper <InputTagHelper>(); __tagHelperExecutionContext.Add(__InputTagHelper); StartTagHelperWritingScope(); #line 6 "EscapedTagHelpers.cshtml" WriteLiteral(DateTime.Now); #line default #line hidden __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper.Type = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper <InputTagHelper2>(); __tagHelperExecutionContext.Add(__InputTagHelper2); __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "EscapedTagHelpers.cshtml" __InputTagHelper2.Checked = true; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(231, 18, true); WriteLiteral("\r\n </p>\r\n</div>"); Instrumentation.EndContext(); }
public void ExecutionContext_Reinitialize_UpdatesTagHelperContextAsExpected() { // Arrange var tagName = "div"; var tagMode = TagMode.StartTagOnly; var items = new Dictionary <object, object>(); var uniqueId = "some unique id"; var callCount = 0; Func <Task> executeChildContentAsync = () => { callCount++; return(Task.FromResult(true)); }; Action <HtmlEncoder> startWritingScope = _ => { }; Func <TagHelperContent> endWritingScope = () => null; var executionContext = new TagHelperExecutionContext( tagName, tagMode, items, uniqueId, executeChildContentAsync, startWritingScope, endWritingScope); var updatedItems = new Dictionary <object, object>(); var updatedUniqueId = "another unique id"; executionContext.AddHtmlAttribute(new TagHelperAttribute("something")); // Act executionContext.Reinitialize( tagName, tagMode, updatedItems, updatedUniqueId, executeChildContentAsync); executionContext.AddHtmlAttribute(new TagHelperAttribute("Another attribute")); // Assert var context = executionContext.Context; var attribute = Assert.Single(context.AllAttributes); Assert.Equal(tagName, context.TagName); Assert.Equal("Another attribute", attribute.Name); Assert.Equal(updatedUniqueId, context.UniqueId); Assert.Same(updatedItems, context.Items); }
public async Task RunAsync_ProcessesAllTagHelpers() { // Arrange var runner = new TagHelperRunner(); var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var executableTagHelper1 = new ExecutableTagHelper(); var executableTagHelper2 = new ExecutableTagHelper(); // Act executionContext.Add(executableTagHelper1); executionContext.Add(executableTagHelper2); await runner.RunAsync(executionContext); // Assert Assert.True(executableTagHelper1.Processed); Assert.True(executableTagHelper2.Processed); }
public void AddHtmlAttributeValues( string attributeName, TagHelperExecutionContext executionContext, params AttributeValue[] values) { if (IsSingleBoolFalseOrNullValue(values)) { // The first value was 'null' or 'false' indicating that we shouldn't render the attribute. The // attribute is treated as a TagHelper attribute so it's only available in // TagHelperContext.AllAttributes for TagHelper authors to see (if they want to see why the attribute // was removed from TagHelperOutput.Attributes). executionContext.AddTagHelperAttribute( attributeName, values[0].Value.Value?.ToString() ?? string.Empty); return; } else if (UseAttributeNameAsValue(values)) { executionContext.AddHtmlAttribute(attributeName, attributeName); } else { var valueBuffer = new StringCollectionTextWriter(Output.Encoding); foreach (var value in values) { if (value.Value.Value == null) { // Skip null values continue; } if (!string.IsNullOrEmpty(value.Prefix)) { WriteLiteralTo(valueBuffer, value.Prefix); } WriteUnprefixedAttributeValueTo(valueBuffer, value); } var htmlString = new HtmlString(valueBuffer.ToString()); executionContext.AddHtmlAttribute(attributeName, htmlString); } }
public void Add_MaintainsMultipleTagHelpers() { // Arrange var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var tagHelper1 = new PTagHelper(); var tagHelper2 = new PTagHelper(); // Act executionContext.Add(tagHelper1); executionContext.Add(tagHelper2); // Assert var tagHelpers = executionContext.TagHelpers.ToArray(); Assert.Equal(2, tagHelpers.Length); Assert.Same(tagHelper1, tagHelpers[0]); Assert.Same(tagHelper2, tagHelpers[1]); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { Instrumentation.BeginContext(27, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p"); __PTagHelper = CreateTagHelper <PTagHelper>(); __tagHelperExecutionContext.Add(__PTagHelper); __PTagHelper.Foo = 1337; __tagHelperExecutionContext.AddTagHelperAttribute("foo", __PTagHelper.Foo); __tagHelperExecutionContext.AddHtmlAttribute("class", "Hello World"); __tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); Instrumentation.BeginContext(63, 11, true); WriteLiteral("Body of Tag"); Instrumentation.EndContext(); WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); __tagHelperExecutionContext = __tagHelperScopeManager.End(); }
public async Task GetChildContentAsync_StartsWritingScopeWithGivenEncoder(HtmlEncoder encoder) { // Arrange HtmlEncoder passedEncoder = null; var executionContext = new TagHelperExecutionContext( "p", tagMode: TagMode.StartTagAndEndTag, items: new Dictionary <object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => Task.FromResult(result: true), startTagHelperWritingScope: encoderArgument => passedEncoder = encoderArgument, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Act await executionContext.GetChildContentAsync(useCachedResult : true, encoder : encoder); // Assert Assert.Same(encoder, passedEncoder); }
public async Task GetChildContentAsync_ReturnsNewObjectEveryTimeItIsCalled(bool useCachedResult) { // Arrange var executionContext = new TagHelperExecutionContext( "p", tagMode: TagMode.StartTagAndEndTag, items: new Dictionary <object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => Task.FromResult(result: true), startTagHelperWritingScope: _ => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Act var content1 = await executionContext.GetChildContentAsync(useCachedResult, encoder : null); var content2 = await executionContext.GetChildContentAsync(useCachedResult, encoder : null); // Assert Assert.NotSame(content1, content2); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); Instrumentation.BeginContext(33, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", TagMode.StartTagAndEndTag, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __PTagHelper = CreateTagHelper <PTagHelper>(); __tagHelperExecutionContext.Add(__PTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(35, 10, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); }
public async Task RunAsync_AllowsModificationOfTagHelperOutput() { // Arrange var runner = new TagHelperRunner(); var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var executableTagHelper = new ExecutableTagHelper(); // Act executionContext.Add(executableTagHelper); executionContext.AddHtmlAttribute("class", "btn", HtmlAttributeValueStyle.DoubleQuotes); await runner.RunAsync(executionContext); // Assert var output = executionContext.Output; Assert.Equal("foo", output.TagName); Assert.Equal("somethingelse", output.Attributes["class"].Value); Assert.Equal("world", output.Attributes["hello"].Value); Assert.Equal(TagMode.SelfClosing, output.TagMode); }
public void AddHtmlAttributeValues_AddsToHtmlAttributesAsExpected( Tuple <string, int, object, int, bool>[] attributeValues, string expectedValue) { // Arrange var page = CreatePage(p => { }); page.HtmlEncoder = new HtmlTestEncoder(); var executionContext = new TagHelperExecutionContext( "p", tagMode: TagMode.StartTagAndEndTag, items: new Dictionary <object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => Task.FromResult(result: true), startTagHelperWritingScope: () => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Act page.BeginAddHtmlAttributeValues(executionContext, "someattr", attributeValues.Length); foreach (var value in attributeValues) { page.AddHtmlAttributeValue(value.Item1, value.Item2, value.Item3, value.Item4, 0, value.Item5); } page.EndAddHtmlAttributeValues(executionContext); // Assert var htmlAttribute = Assert.Single(executionContext.HTMLAttributes); Assert.Equal("someattr", htmlAttribute.Name, StringComparer.Ordinal); var htmlContent = Assert.IsAssignableFrom <IHtmlContent>(htmlAttribute.Value); Assert.Equal(expectedValue, HtmlContentUtilities.HtmlContentToString(htmlContent), StringComparer.Ordinal); Assert.False(htmlAttribute.Minimized); var allAttribute = Assert.Single(executionContext.AllAttributes); Assert.Equal("someattr", allAttribute.Name, StringComparer.Ordinal); htmlContent = Assert.IsAssignableFrom <IHtmlContent>(allAttribute.Value); Assert.Equal(expectedValue, HtmlContentUtilities.HtmlContentToString(htmlContent), StringComparer.Ordinal); Assert.False(allAttribute.Minimized); }
public void AddHtmlAttribute_MaintainsMinimizedHtmlAttributes() { // Arrange var executionContext = new TagHelperExecutionContext("input", tagMode: TagMode.StartTagOnly); var expectedAttributes = new TagHelperAttributeList { new TagHelperAttribute("checked"), new TagHelperAttribute("visible"), }; // Act executionContext.AddHtmlAttribute(new TagHelperAttribute("checked")); executionContext.AddHtmlAttribute(new TagHelperAttribute("visible")); var output = executionContext.Output; // Assert Assert.Equal( expectedAttributes, output.Attributes, CaseSensitiveTagHelperAttributeComparer.Default); }
public void ParentItems_SetsItemsProperty() { // Arrange var expectedItems = new Dictionary <object, object> { { "test-entry", 1234 } }; // Act var executionContext = new TagHelperExecutionContext( "p", tagMode: TagMode.StartTagAndEndTag, items: expectedItems, uniqueId: string.Empty, executeChildContentAsync: async() => await Task.FromResult(result: true), startTagHelperWritingScope: _ => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Assert Assert.NotNull(executionContext.Items); Assert.Same(expectedItems, executionContext.Items); }
public void EndAddHtmlAttributeValues(TagHelperExecutionContext executionContext) { if (!_tagHelperAttributeInfo.Suppressed) { HtmlString htmlString; if (_valueBuffer != null) { using (var stringWriter = new StringWriter()) { _valueBuffer.Content.WriteTo(stringWriter, HtmlEncoder); htmlString = new HtmlString(stringWriter.ToString()); } } else { htmlString = HtmlString.Empty; } executionContext.AddHtmlAttribute(_tagHelperAttributeInfo.Name, htmlString); } }
public void AddHtmlAttribute_MaintainsHtmlAttributes() { // Arrange var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var expectedAttributes = new TagHelperAttributeList { { "class", "btn" }, }; expectedAttributes.Add(new TagHelperAttribute("type", "text", HtmlAttributeValueStyle.SingleQuotes)); // Act executionContext.AddHtmlAttribute("class", "btn", HtmlAttributeValueStyle.DoubleQuotes); executionContext.AddHtmlAttribute("type", "text", HtmlAttributeValueStyle.SingleQuotes); var output = executionContext.Output; // Assert Assert.Equal( expectedAttributes, output.Attributes, CaseSensitiveTagHelperAttributeComparer.Default); }
public void WriteTo_WritesFormattedTagHelper(TagHelperOutput output, string expected) { // Arrange var writer = new StringWriter(); var tagHelperExecutionContext = new TagHelperExecutionContext( tagName: output.TagName, tagMode: output.TagMode, items: new Dictionary <object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => Task.FromResult(result: true), startTagHelperWritingScope: _ => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); tagHelperExecutionContext.Output = output; var testEncoder = new HtmlTestEncoder(); // Act output.WriteTo(writer, testEncoder); // Assert Assert.Equal(expected, writer.ToString(), StringComparer.Ordinal); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { Instrumentation.BeginContext(27, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("mytaghelper"); __MyTagHelper = CreateTagHelper <MyTagHelper>(); __tagHelperExecutionContext.Add(__MyTagHelper); __tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); Instrumentation.BeginContext(367, 9, false); #line 12 "TagHelpersInHelper.cshtml" Write(MyHelper(item => new Template((__razor_template_writer) => { __tagHelperExecutionContext = __tagHelperScopeManager.Begin("nestedtaghelper"); __NestedTagHelper = CreateTagHelper <NestedTagHelper>(); __tagHelperExecutionContext.Add(__NestedTagHelper); StartWritingScope(); WriteLiteral("Custom Value"); __tagHelperStringValueBuffer = EndWritingScope(); __tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext, __tagHelperStringValueBuffer).Result; WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateStartTag()); WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateContent()); WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateEndTag()); __tagHelperExecutionContext = __tagHelperScopeManager.End(); } ) )); #line default #line hidden Instrumentation.EndContext(); WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(439, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { Instrumentation.BeginContext(27, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", "test", async() => { WriteLiteral("Body of Tag"); } , StartWritingScope, EndWritingScope); __PTagHelper = CreateTagHelper <PTagHelper>(); __tagHelperExecutionContext.Add(__PTagHelper); #line 3 "SingleTagHelper.cshtml" __PTagHelper.Age = 1337; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age); __tagHelperExecutionContext.AddHtmlAttribute("class", "Hello World"); __tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); WriteLiteral(__tagHelperExecutionContext.Output.GeneratePreContent()); if (__tagHelperExecutionContext.Output.ContentSet) { WriteLiteral(__tagHelperExecutionContext.Output.GenerateContent()); } else if (__tagHelperExecutionContext.ChildContentRetrieved) { WriteLiteral(__tagHelperExecutionContext.GetChildContentAsync().Result); } else { __tagHelperExecutionContext.ExecuteChildContentAsync().Wait(); } WriteLiteral(__tagHelperExecutionContext.Output.GeneratePostContent()); WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); __tagHelperExecutionContext = __tagHelperScopeManager.End(); }
public async Task Process_AddsHiddenInputTag_FromEndOfFormContent_WithCachedBody( List <TagBuilder> tagBuilderList, string expectedOutput) { // Arrange var viewContext = new ViewContext(); var runner = new TagHelperRunner(); var tagHelperExecutionContext = new TagHelperExecutionContext( "form", TagMode.StartTagAndEndTag, items: new Dictionary <object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => { foreach (var item in tagBuilderList) { viewContext.FormContext.EndOfFormContent.Add(item); } return(Task.FromResult(true)); }, startTagHelperWritingScope: _ => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // This TagHelper will pre-execute the child content forcing the body to be cached. tagHelperExecutionContext.Add(new ChildContentInvoker()); tagHelperExecutionContext.Add(new RenderAtEndOfFormTagHelper { ViewContext = viewContext }); // Act var output = await runner.RunAsync(tagHelperExecutionContext); // Assert Assert.Equal(expectedOutput, output.PostContent.GetContent()); }
public async Task WriteTagHelperAsync_WritesContentAppropriately( bool childContentRetrieved, string input, string expected) { // Arrange var defaultTagHelperContent = new DefaultTagHelperContent(); var writer = new StringCollectionTextWriter(Encoding.UTF8); var context = CreateViewContext(writer); var tagHelperExecutionContext = new TagHelperExecutionContext( tagName: "p", selfClosing: false, items: new Dictionary <object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => { defaultTagHelperContent.SetContent(input); return(Task.FromResult(result: true)); }, startTagHelperWritingScope: () => { }, endTagHelperWritingScope: () => defaultTagHelperContent); tagHelperExecutionContext.Output = new TagHelperOutput("p", new Dictionary <string, object>()); if (childContentRetrieved) { await tagHelperExecutionContext.GetChildContentAsync(); } // Act var page = CreatePage(p => { p.HtmlEncoder = new HtmlEncoder(); p.WriteTagHelperAsync(tagHelperExecutionContext).Wait(); }, context); await page.ExecuteAsync(); // Assert Assert.Equal(expected, writer.ToString()); }
public async Task RunAsync_OrdersTagHelpers( int[] tagHelperOrders, int[] expectedTagHelperOrders) { // Arrange var runner = new TagHelperRunner(); var executionContext = new TagHelperExecutionContext("p", TagMode.StartTagAndEndTag); var processOrder = new List <int>(); foreach (var order in tagHelperOrders) { var orderedTagHelper = new OrderedTagHelper(order) { ProcessOrderTracker = processOrder }; executionContext.Add(orderedTagHelper); } // Act await runner.RunAsync(executionContext); // Assert Assert.Equal(expectedTagHelperOrders, processOrder); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); Instrumentation.BeginContext(33, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", false, "test", async() => { WriteLiteral("Body of Tag"); } , StartTagHelperWritingScope, EndTagHelperWritingScope); __PTagHelper = CreateTagHelper <PTagHelper>(); __tagHelperExecutionContext.Add(__PTagHelper); #line 3 "SingleTagHelper.cshtml" __PTagHelper.Age = 1337; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); Instrumentation.BeginContext(33, 106, true); WriteLiteral("\r\n<script type=\"text/html\">\r\n <div data-animation=\"fade\" class=\"randomNonTagHe" + "lperAttribute\">\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", TagMode.StartTagAndEndTag, "test", async() => { Instrumentation.BeginContext(180, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); #line 6 "NestedScriptTagTagHelpers.cshtml" #line default #line hidden #line 6 "NestedScriptTagTagHelpers.cshtml" for (var i = 0; i < 5; i++) { #line default #line hidden Instrumentation.BeginContext(225, 84, true); WriteLiteral(" <script id=\"nestedScriptTag\" type=\"text/html\">\r\n " + " "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.StartTagOnly, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper <InputTagHelper>(); __tagHelperExecutionContext.Add(__InputTagHelper); __InputTagHelper2 = CreateTagHelper <InputTagHelper2>(); __tagHelperExecutionContext.Add(__InputTagHelper2); StartTagHelperWritingScope(); WriteLiteral("2000 + "); #line 8 "NestedScriptTagTagHelpers.cshtml" Write(ViewBag.DefaultInterval); #line default #line hidden WriteLiteral(" + 1"); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer.GetContent(HtmlEncoder))); __InputTagHelper.Type = "text"; __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 8 "NestedScriptTagTagHelpers.cshtml" __InputTagHelper2.Checked = true; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(309, 86, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(395, 29, true); WriteLiteral("\r\n </script>\r\n"); Instrumentation.EndContext(); #line 10 "NestedScriptTagTagHelpers.cshtml" } #line default #line hidden Instrumentation.BeginContext(439, 129, true); WriteLiteral(" <script type=\"text/javascript\">\r\n var tag = \'<input ch" + "ecked=\"true\">\';\r\n </script>\r\n "); Instrumentation.EndContext(); } , StartTagHelperWritingScope, EndTagHelperWritingScope); __PTagHelper = CreateTagHelper <PTagHelper>(); __tagHelperExecutionContext.Add(__PTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.AddHtmlAttribute("data-delay", Html.Raw("1000")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(139, 433, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(572, 23, true); WriteLiteral("\r\n </div>\r\n</script>"); Instrumentation.EndContext(); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); Instrumentation.BeginContext(33, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); #line 3 "TagHelpersInSection.cshtml" var code = "some code"; #line default #line hidden Instrumentation.BeginContext(71, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); DefineSection("MySection", async(__razor_template_writer) => { Instrumentation.BeginContext(93, 21, true); WriteLiteralTo(__razor_template_writer, "\r\n <div>\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("mytaghelper", TagMode.StartTagAndEndTag, "test", async() => { Instrumentation.BeginContext(217, 52, true); WriteLiteral("\r\n In None ContentBehavior.\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("nestedtaghelper", TagMode.StartTagAndEndTag, "test", async() => { Instrumentation.BeginContext(286, 26, true); WriteLiteral("Some buffered values with "); Instrumentation.EndContext(); Instrumentation.BeginContext(313, 4, false); #line 11 "TagHelpersInSection.cshtml" Write(code); #line default #line hidden Instrumentation.EndContext(); } , StartTagHelperWritingScope, EndTagHelperWritingScope); __NestedTagHelper = CreateTagHelper <NestedTagHelper>(); __tagHelperExecutionContext.Add(__NestedTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(269, 66, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(335, 10, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); } , StartTagHelperWritingScope, EndTagHelperWritingScope); __MyTagHelper = CreateTagHelper <MyTagHelper>(); __tagHelperExecutionContext.Add(__MyTagHelper); StartTagHelperWritingScope(); WriteLiteral("Current Time: "); #line 9 "TagHelpersInSection.cshtml" WriteLiteral(DateTime.Now); #line default #line hidden __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __MyTagHelper.BoundProperty = __tagHelperStringValueBuffer.GetContent(HtmlEncoder); __tagHelperExecutionContext.AddTagHelperAttribute("boundproperty", __MyTagHelper.BoundProperty); BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unboundproperty", 3); AddHtmlAttributeValue("", 188, "Current", 188, 7, true); AddHtmlAttributeValue(" ", 195, "Time:", 196, 6, true); #line 9 "TagHelpersInSection.cshtml" AddHtmlAttributeValue(" ", 201, DateTime.Now, 202, 14, false); #line default #line hidden EndAddHtmlAttributeValues(__tagHelperExecutionContext); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(114, 245, false); await WriteTagHelperToAsync(__razor_template_writer, __tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(359, 14, true); WriteLiteralTo(__razor_template_writer, "\r\n </div>\r\n"); Instrumentation.EndContext(); } ); }
public void EndAddHtmlAttributeValues(TagHelperExecutionContext executionContext) { }
#pragma warning disable 1998 public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new TagHelperRunner(); Instrumentation.BeginContext(33, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", TagMode.StartTagAndEndTag, "test", async() => { Instrumentation.BeginContext(64, 34, true); WriteLiteral("\r\n <input nottaghelper />\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __CatchAllTagHelper = CreateTagHelper <CatchAllTagHelper>(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(98, 59, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(157, 6, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper <InputTagHelper>(); __tagHelperExecutionContext.Add(__InputTagHelper); __CatchAllTagHelper = CreateTagHelper <CatchAllTagHelper>(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required"); __InputTagHelper.BoundRequiredString = "hello"; __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(163, 119, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(282, 6, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper <InputTagHelper>(); __tagHelperExecutionContext.Add(__InputTagHelper); __CatchAllTagHelper = CreateTagHelper <CatchAllTagHelper>(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required"); __CatchAllTagHelper.BoundRequiredString = "world"; __tagHelperExecutionContext.AddTagHelperAttribute("catchall-bound-string", __CatchAllTagHelper.BoundRequiredString); __InputTagHelper.BoundRequiredString = "hello2"; __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(288, 176, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(464, 6, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", TagMode.SelfClosing, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper <InputTagHelper>(); __tagHelperExecutionContext.Add(__InputTagHelper); __CatchAllTagHelper = CreateTagHelper <CatchAllTagHelper>(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); __tagHelperExecutionContext.AddHtmlAttribute("catchall-unbound-required", Html.Raw("hello")); __tagHelperExecutionContext.AddHtmlAttribute("input-unbound-required", Html.Raw("hello2")); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __InputTagHelper.BoundRequiredString = "world"; __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(470, 206, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(676, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); } , StartTagHelperWritingScope, EndTagHelperWritingScope); __CatchAllTagHelper = CreateTagHelper <CatchAllTagHelper>(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(35, 647, false); await WriteTagHelperAsync(__tagHelperExecutionContext); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { Instrumentation.BeginContext(27, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); #line 3 "TagHelpersInSection.cshtml" var code = "some code"; #line default #line hidden Instrumentation.BeginContext(63, 4, true); WriteLiteral("\r\n\r\n"); Instrumentation.EndContext(); DefineSection("MySection", async(__razor_template_writer) => { Instrumentation.BeginContext(87, 21, true); WriteLiteralTo(__razor_template_writer, "\r\n <div>\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("mytaghelper", "test", async() => { WriteLiteral("\r\n In None ContentBehavior.\r\n "); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("nestedtaghelper", "test", async() => { WriteLiteral("Some buffered values with "); #line 11 "TagHelpersInSection.cshtml" Write(code); #line default #line hidden } , StartWritingScope, EndWritingScope); __NestedTagHelper = CreateTagHelper <NestedTagHelper>(); __tagHelperExecutionContext.Add(__NestedTagHelper); __tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; WriteLiteral(__tagHelperExecutionContext.Output.GenerateStartTag()); WriteLiteral(__tagHelperExecutionContext.Output.GeneratePreContent()); if (__tagHelperExecutionContext.Output.ContentSet) { WriteLiteral(__tagHelperExecutionContext.Output.GenerateContent()); } else if (__tagHelperExecutionContext.ChildContentRetrieved) { WriteLiteral(__tagHelperExecutionContext.GetChildContentAsync().Result); } else { __tagHelperExecutionContext.ExecuteChildContentAsync().Wait(); } WriteLiteral(__tagHelperExecutionContext.Output.GeneratePostContent()); WriteLiteral(__tagHelperExecutionContext.Output.GenerateEndTag()); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); } , StartWritingScope, EndWritingScope); __MyTagHelper = CreateTagHelper <MyTagHelper>(); __tagHelperExecutionContext.Add(__MyTagHelper); StartWritingScope(); WriteLiteral("Current Time: "); #line 9 "TagHelpersInSection.cshtml" Write(DateTime.Now); #line default #line hidden __tagHelperStringValueBuffer = EndWritingScope(); __MyTagHelper.BoundProperty = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("BoundProperty", __MyTagHelper.BoundProperty); StartWritingScope(); WriteLiteral("Current Time: "); #line 9 "TagHelpersInSection.cshtml" Write(DateTime.Now); #line default #line hidden __tagHelperStringValueBuffer = EndWritingScope(); __tagHelperExecutionContext.AddHtmlAttribute("unboundproperty", __tagHelperStringValueBuffer.ToString()); __tagHelperExecutionContext.Output = __tagHelperRunner.RunAsync(__tagHelperExecutionContext).Result; WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateStartTag()); WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GeneratePreContent()); if (__tagHelperExecutionContext.Output.ContentSet) { WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateContent()); } else if (__tagHelperExecutionContext.ChildContentRetrieved) { WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.GetChildContentAsync().Result); } else { StartWritingScope(__razor_template_writer); __tagHelperExecutionContext.ExecuteChildContentAsync().Wait(); EndWritingScope(); } WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GeneratePostContent()); WriteLiteralTo(__razor_template_writer, __tagHelperExecutionContext.Output.GenerateEndTag()); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(353, 14, true); WriteLiteralTo(__razor_template_writer, "\r\n </div>\r\n"); Instrumentation.EndContext(); } ); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { Instrumentation.BeginContext(33, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); #line 3 "TagHelpersInSection.cshtml" var code = "some code"; #line default #line hidden Instrumentation.BeginContext(69, 4, true); WriteLiteral("\r\n\r\n"); Instrumentation.EndContext(); DefineSection("MySection", async(__razor_template_writer) => { Instrumentation.BeginContext(93, 21, true); WriteLiteralTo(__razor_template_writer, "\r\n <div>\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("mytaghelper", false, "test", async() => { WriteLiteral("\r\n In None ContentBehavior.\r\n "); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("nestedtaghelper", false, "test", async() => { WriteLiteral("Some buffered values with "); #line 11 "TagHelpersInSection.cshtml" Write(code); #line default #line hidden } , StartTagHelperWritingScope, EndTagHelperWritingScope); __NestedTagHelper = CreateTagHelper<NestedTagHelper>(); __tagHelperExecutionContext.Add(__NestedTagHelper); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); } , StartTagHelperWritingScope, EndTagHelperWritingScope); __MyTagHelper = CreateTagHelper<MyTagHelper>(); __tagHelperExecutionContext.Add(__MyTagHelper); StartTagHelperWritingScope(); WriteLiteral("Current Time: "); #line 9 "TagHelpersInSection.cshtml" WriteLiteral(DateTime.Now); #line default #line hidden __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __MyTagHelper.BoundProperty = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("BoundProperty", __MyTagHelper.BoundProperty); StartTagHelperWritingScope(); WriteLiteral("Current Time: "); #line 9 "TagHelpersInSection.cshtml" Write(DateTime.Now); #line default #line hidden __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __tagHelperExecutionContext.AddHtmlAttribute("unboundproperty", Html.Raw(__tagHelperStringValueBuffer.ToString())); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperToAsync(__razor_template_writer, __tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); Instrumentation.BeginContext(359, 14, true); WriteLiteralTo(__razor_template_writer, "\r\n </div>\r\n"); Instrumentation.EndContext(); } ); }