public async Task ExecuteChildContentAsync_IsNotMemoized() { // Arrange var childContentExecutionCount = 0; var executionContext = new TagHelperExecutionContext( "p", uniqueId: string.Empty, executeChildContentAsync: () => { childContentExecutionCount++; return(Task.FromResult(result: true)); }, startWritingScope: () => { }, endWritingScope: () => new StringWriter()); // Act await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); // Assert Assert.Equal(3, childContentExecutionCount); }
public async Task ExecuteChildContentAsync_IsNotMemoized() { // Arrange var childContentExecutionCount = 0; var executionContext = new TagHelperExecutionContext( "p", tagMode: TagMode.StartTagAndEndTag, items: null, uniqueId: string.Empty, executeChildContentAsync: () => { childContentExecutionCount++; return(Task.FromResult(result: true)); }, startTagHelperWritingScope: () => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Act await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); // Assert Assert.Equal(3, childContentExecutionCount); }
public async Task ExecuteChildContentAsync_IsNotMemoized() { // Arrange var childContentExecutionCount = 0; var executionContext = new TagHelperExecutionContext( "p", selfClosing: false, items: null, uniqueId: string.Empty, executeChildContentAsync: () => { childContentExecutionCount++; return Task.FromResult(result: true); }, startTagHelperWritingScope: () => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Act await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); // Assert Assert.Equal(3, childContentExecutionCount); }
public async Task ExecuteChildContentAsync_IsNotMemoized() { // Arrange var childContentExecutionCount = 0; var executionContext = new TagHelperExecutionContext( "p", tagMode: TagMode.StartTagAndEndTag, items: new Dictionary<object, object>(), uniqueId: string.Empty, executeChildContentAsync: () => { childContentExecutionCount++; return Task.FromResult(result: true); }, startTagHelperWritingScope: () => { }, endTagHelperWritingScope: () => new DefaultTagHelperContent()); // Act await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); await executionContext.ExecuteChildContentAsync(); // Assert Assert.Equal(3, childContentExecutionCount); }
#pragma warning disable 1998 public override async Task ExecuteAsync() { BeginContext(120, 2, true); WriteLiteral("\r\n"); EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", "test", async() => { } , StartWritingScope, EndWritingScope); __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper <Microsoft.AspNet.Mvc.Razor.InputTestTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper); #line 5 "TestFiles/Input/ModelExpressionTagHelper.cshtml" __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For); __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(); BeginContext(146, 2, true); WriteLiteral("\r\n"); EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", "test", async() => { } , StartWritingScope, EndWritingScope); __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper <Microsoft.AspNet.Mvc.Razor.InputTestTagHelper>(); __tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper); #line 6 "TestFiles/Input/ModelExpressionTagHelper.cshtml" __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => Model); #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For); __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(); }