diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index e958e983182f6..b89f3a2d6405d 100644 --- a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -4,7 +4,9 @@ #nullable disable using System.Globalization; +using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis; @@ -35,6 +37,78 @@ protected override string GetDirectoryPath(string testName) return $"TestFiles/IntegrationTests/ComponentCodeGenerationTest/{testName}"; } + /// + /// Shadow of the base CompileToAssembly that, after compiling and verifying no + /// unexpected C# diagnostics, also asserts a .builder.txt baseline: the + /// component's render-tree-builder calls ordered by sequence number (see + /// ). Every test calling CompileToAssembly(generated) + /// picks up the check with no per-test change; pass + /// false to opt a test out (for example + /// one whose generated render operations aren't deterministic across runs). + /// + /// + /// The .codegen.cs / .decl.codegen.cs baselines pin the emitted C# + /// byte-for-byte, so they move under cosmetic reorganization -- which partial half a + /// member lands in, line-pragma layout, whitespace -- that doesn't change what the + /// component renders. The builder baseline is a sequence-ordered projection of just the + /// render operations: it stays put under that reorganization yet still trips on a real + /// change (a different element, a dropped attribute, a renumbered fragment). + /// + protected CompileToAssemblyResult CompileToAssembly( + CompileToCSharpResult cSharpResult, + bool assertBuilderBaseline = true, + [CallerMemberName] string testName = "") + { + var result = RazorIntegrationTestBase.CompileToAssembly(cSharpResult); + if (assertBuilderBaseline) + { + AssertBuilderCallsMatchBaseline(cSharpResult, testName); + } + + return result; + } + + /// + /// Diagnostic-expecting overload: shadowed so call sites that pass expected + /// diagnostics resolve here. The builder-baseline check is skipped because + /// compile-error tests don't emit a meaningful render tree. + /// + protected new CompileToAssemblyResult CompileToAssembly( + CompileToCSharpResult cSharpResult, + params DiagnosticDescription[] expectedDiagnostics) + { + return RazorIntegrationTestBase.CompileToAssembly(cSharpResult, expectedDiagnostics); + } + + private void AssertBuilderCallsMatchBaseline(CompileToCSharpResult cSharpResult, string testName) + { + var dump = BuilderCallDumper.Dump([cSharpResult.Code, cSharpResult.DeclCode]); + + var baselineFilePath = GetBaselineFilePath(cSharpResult.CodeDocument, ".builder.txt", testName); + if (GenerateBaselines.ShouldGenerate) + { + if (dump.Length == 0) + { + // No render-tree-builder calls (e.g. a code-only component) -- nothing to pin. + return; + } + + var baselineFullPath = Path.Combine(TestProjectRoot, baselineFilePath); + Directory.CreateDirectory(Path.GetDirectoryName(baselineFullPath)); + File.WriteAllText(baselineFullPath, dump, new System.Text.UTF8Encoding(encoderShouldEmitUTF8Identifier: true)); + return; + } + + var baselineFile = TestFile.Create(baselineFilePath, GetType().Assembly); + if (!baselineFile.Exists()) + { + // Component emits no builder calls, or its baseline predates this check. + return; + } + + Assert.Equal(baselineFile.ReadAllText(), dump); + } + #region Basics [Fact] diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddAttribute_ImplicitStringConversion_BindUnknown/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddAttribute_ImplicitStringConversion_BindUnknown/TestComponent.builder.txt new file mode 100644 index 0000000000000..f87d83a47a948 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddAttribute_ImplicitStringConversion_BindUnknown/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddAttribute("Value", (object)( c )) +[0002] AddAttribute("ValueChanged", (object)(global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => c = __value, c))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddAttribute_ImplicitStringConversion_BindUnknown_Assignment/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddAttribute_ImplicitStringConversion_BindUnknown_Assignment/TestComponent.builder.txt new file mode 100644 index 0000000000000..924fce4aa7b22 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddAttribute_ImplicitStringConversion_BindUnknown_Assignment/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddAttribute("Value", (object)( c1 = c2 )) +[0002] AddAttribute("ValueChanged", (object)(global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => c1 = c2 = __value, c1 = c2))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_DynamicComponentName/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_DynamicComponentName/TestComponent.builder.txt new file mode 100644 index 0000000000000..de5a8c4d3a863 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_DynamicComponentName/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.dynamic. Value ), "Hello") \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_EscapedComponentName/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_EscapedComponentName/TestComponent.builder.txt new file mode 100644 index 0000000000000..c7023fad23cfd --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_EscapedComponentName/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.@int. Value ), "Hello") \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_GlobalNamespace/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_GlobalNamespace/TestComponent.builder.txt new file mode 100644 index 0000000000000..be2407e62acb6 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AddComponentParameter_GlobalNamespace/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::MyComponent. Value ), "Hello") \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.builder.txt new file mode 100644 index 0000000000000..96157990b0726 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_Lambda/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenElement("input") +[0001] AddAttribute("onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, async (e) => await Task.Delay(10) )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.builder.txt new file mode 100644 index 0000000000000..1cc09bfb7eb4f --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_ActionEventArgs_MethodGroup/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenElement("input") +[0001] AddAttribute("onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.builder.txt new file mode 100644 index 0000000000000..5cf66508a5e24 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_Action_Lambda/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenElement("input") +[0001] AddAttribute("onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, async () => await Task.Delay(10) )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.builder.txt new file mode 100644 index 0000000000000..1cc09bfb7eb4f --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AsyncEventHandler_OnElement_Action_MethodGroup/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] OpenElement("input") +[0001] AddAttribute("onclick", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, OnClick )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AtTransitions/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AtTransitions/TestComponent.builder.txt new file mode 100644 index 0000000000000..104e0ff30e87b --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/AtTransitions/TestComponent.builder.txt @@ -0,0 +1,2 @@ +[0000] AddContent(x) +[0001] AddContent(x) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.builder.txt new file mode 100644 index 0000000000000..8f14f5e63d8e9 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.builder.txt @@ -0,0 +1,4 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)))) +[0003] AddComponentParameter(nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.builder.txt new file mode 100644 index 0000000000000..b90c3bab44ccc --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValue_WithMatchingProperties/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.builder.txt new file mode 100644 index 0000000000000..08d500c32ca28 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.OnChanged), (global::System.Action)(__value => ParentValue = __value)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.builder.txt new file mode 100644 index 0000000000000..ef6207b4ee554 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithoutMatchingProperties/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter("Value", ParentValue) +[0002] AddComponentParameter("OnChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.builder.txt new file mode 100644 index 0000000000000..627338dde9c54 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.builder.txt @@ -0,0 +1,4 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)) +[0003] AddComponentParameter(nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.builder.txt new file mode 100644 index 0000000000000..afdb3d08354cf --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.builder.txt new file mode 100644 index 0000000000000..a6154d33e544f --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.dynamic. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.dynamic.ValueChanged), (global::System.Action)(__value => ParentValue = __value)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.builder.txt new file mode 100644 index 0000000000000..738eb1c7ee86f --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.@int. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.@int.ValueChanged), (global::System.Action)(__value => ParentValue = __value)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.builder.txt new file mode 100644 index 0000000000000..2509ab39404b2 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.builder.txt new file mode 100644 index 0000000000000..e77818190cdbd --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_SpecifiesValue_WithoutMatchingProperties/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter("Value", ParentValue) +[0002] AddComponentParameter("ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.builder.txt new file mode 100644 index 0000000000000..ef1deec3788c4 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( Update ); })) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.builder.txt new file mode 100644 index 0000000000000..0c494c8417169 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( () => { } ); })) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.builder.txt new file mode 100644 index 0000000000000..ca8479bb2c64f --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: () => { } ); }, value: ParentValue), ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.builder.txt new file mode 100644 index 0000000000000..870171c129a4c --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue ); }, value: ParentValue), ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_InsideTemplateWithDiscardContext/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_InsideTemplateWithDiscardContext/TestComponent.builder.txt new file mode 100644 index 0000000000000..ae5579c5d4579 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_InsideTemplateWithDiscardContext/TestComponent.builder.txt @@ -0,0 +1,5 @@ +[0000] OpenComponent() +[0001] AddAttribute("ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((_) => (__builder2) => { __builder2.OpenComponent(2); __builder2.AddComponentParameter(3, nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )); __builder2.AddComponentParameter(4, nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: OnAfter ); }, value: ParentValue), ParentValue)))); var (_, _) = (nameof(global::Test.MyComponent. Value ), 0); __builder2.CloseComponent(); } )) +[0002] OpenComponent() +[0003] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0004] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: OnAfter ); }, value: ParentValue), ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.builder.txt new file mode 100644 index 0000000000000..d2a3c56f7cd3b --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( Update ); })) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.builder.txt new file mode 100644 index 0000000000000..44c95f3961f48 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( () => { return Task.CompletedTask; } ); })) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.builder.txt new file mode 100644 index 0000000000000..6fbd045f05b82 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( UpdateValue )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.builder.txt new file mode 100644 index 0000000000000..5f01fd901a852 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( value => ParentValue = value )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.builder.txt new file mode 100644 index 0000000000000..9c0cd9681d0f0 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue , ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.builder.txt new file mode 100644 index 0000000000000..788629aa12c15 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesAction/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, value => ParentValue = value , ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.builder.txt new file mode 100644 index 0000000000000..9c0cd9681d0f0 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_EventCallback_ReceivesFunction/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue , ParentValue)))) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.builder.txt new file mode 100644 index 0000000000000..0ab0a0d57fc73 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)( UpdateValue )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.builder.txt new file mode 100644 index 0000000000000..0a2a20eeed9ce --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.MyComponent. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( ParentValue )) +[0002] AddComponentParameter(nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)( value => { ParentValue = value; return Task.CompletedTask; } )) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.builder.txt new file mode 100644 index 0000000000000..0c55b069d4937 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenComponent() +[0001] AddComponentParameter(nameof(global::Test.InputText. Value ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( person.Name )) +[0002] AddComponentParameter(nameof(global::Test.InputText.ValueChanged), (global::System.Action)(__value => person.Name = __value)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.builder.txt new file mode 100644 index 0000000000000..704df2d489c3f --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WithCulture/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("value", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue , culture: CultureInfo.InvariantCulture )) +[0002] AddAttribute("onchange", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue, culture: CultureInfo.InvariantCulture)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.builder.txt new file mode 100644 index 0000000000000..bd9707cccc9a1 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WithFormat_WritesAttributes/TestComponent.builder.txt @@ -0,0 +1,4 @@ +[0000] OpenElement("input") +[0001] AddAttribute("type", "text") +[0002] AddAttribute("value", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( CurrentDate , format: "MM/dd")) +[0003] AddAttribute("onchange", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => CurrentDate = __value, CurrentDate, format: "MM/dd")) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.builder.txt new file mode 100644 index 0000000000000..8303913c10756 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementFallback_WritesAttributes/TestComponent.builder.txt @@ -0,0 +1,4 @@ +[0000] OpenElement("input") +[0001] AddAttribute("type", "text") +[0002] AddAttribute("value", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0003] AddAttribute("onchange", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithCulture/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithCulture/TestComponent.builder.txt new file mode 100644 index 0000000000000..d0bdbded4e5a0 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithCulture/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue , culture: CultureInfo.InvariantCulture )) +[0002] AddAttribute("anotherevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue, culture: CultureInfo.InvariantCulture)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.builder.txt new file mode 100644 index 0000000000000..6958f4f357a64 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithSuffix_OverridesEvent/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute("anotherevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.builder.txt new file mode 100644 index 0000000000000..49e98b6795c87 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElementWithSuffix_WritesAttributes/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute("myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.builder.txt new file mode 100644 index 0000000000000..e2dde3feeba6b --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute("myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: DoSomething ); }, value: ParentValue), ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.builder.txt new file mode 100644 index 0000000000000..94ac97c15084c --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithEventAsExplicitExpression/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute(x.ToString(), global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.builder.txt new file mode 100644 index 0000000000000..51b5adbfb490b --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithEventAsExpression/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute(x, global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.builder.txt new file mode 100644 index 0000000000000..a6dacc1917a04 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute("myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: ValueChanged , value: ParentValue), ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.builder.txt new file mode 100644 index 0000000000000..49e98b6795c87 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithStringAttribute_WritesAttributes/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute("myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithoutCloseTag/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithoutCloseTag/TestComponent.builder.txt new file mode 100644 index 0000000000000..e6de744617d12 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WithoutCloseTag/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] OpenElement("input") +[0002] AddAttribute("@bind", ParentValue) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.builder.txt new file mode 100644 index 0000000000000..49e98b6795c87 --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToElement_WritesAttributes/TestComponent.builder.txt @@ -0,0 +1,3 @@ +[0000] OpenElement("div") +[0001] AddAttribute("myvalue", global::Microsoft.AspNetCore.Components.BindConverter.FormatValue( ParentValue )) +[0002] AddAttribute("myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, __value => ParentValue = __value, ParentValue)) \ No newline at end of file diff --git a/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.builder.txt b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.builder.txt new file mode 100644 index 0000000000000..c49e8fe9c6f9a --- /dev/null +++ b/src/Razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentCodeGenerationTest/BindToGenericComponent_ExplicitType_WithAfter_Action/TestComponent.builder.txt @@ -0,0 +1,11 @@ +[0000] OpenComponent