From a47dd7ad63b3ef043e808955da257dd4be62d1b3 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Mon, 25 Jan 2016 17:38:55 -0800 Subject: [PATCH] Fix design time line mapping Razor Host tests. --- .../MvcRazorHostTest.cs | 288 +++++++++--------- .../DesignTime/ModelExpressionTagHelper.cs | 10 +- .../Runtime/ModelExpressionTagHelper.cs | 28 +- 3 files changed, 163 insertions(+), 163 deletions(-) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/MvcRazorHostTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/MvcRazorHostTest.cs index e6359b0093..8961f51ace 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/MvcRazorHostTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/MvcRazorHostTest.cs @@ -134,38 +134,38 @@ namespace Microsoft.AspNetCore.Mvc.Razor { var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 33, - documentLineIndex: 2, - documentCharacterIndex: 14, - generatedAbsoluteIndex: 590, - generatedLineIndex: 16, - generatedCharacterIndex: 48, - contentLength: 83), - BuildLineMapping( - documentAbsoluteIndex: 7, - documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 764, - generatedLineIndex: 18, - generatedCharacterIndex: 28, - contentLength: 8), - BuildLineMapping( - documentAbsoluteIndex: 137, - documentLineIndex: 4, - documentCharacterIndex: 17, - generatedAbsoluteIndex: 2180, - generatedLineIndex: 47, - generatedCharacterIndex: 95, - contentLength: 3), - BuildLineMapping( - documentAbsoluteIndex: 164, - documentLineIndex: 5, - documentCharacterIndex: 18, - generatedAbsoluteIndex: 2501, - generatedLineIndex: 53, - generatedCharacterIndex: 87, - contentLength: 5), + BuildLineMapping( + documentAbsoluteIndex: 33, + documentLineIndex: 2, + documentCharacterIndex: 14, + generatedAbsoluteIndex: 602, + generatedLineIndex: 16, + generatedCharacterIndex: 48, + contentLength: 91), + BuildLineMapping( + documentAbsoluteIndex: 7, + documentLineIndex: 0, + documentCharacterIndex: 7, + generatedAbsoluteIndex: 784, + generatedLineIndex: 18, + generatedCharacterIndex: 28, + contentLength: 8), + BuildLineMapping( + documentAbsoluteIndex: 145, + documentLineIndex: 4, + documentCharacterIndex: 17, + generatedAbsoluteIndex: 2252, + generatedLineIndex: 47, + generatedCharacterIndex: 99, + contentLength: 3), + BuildLineMapping( + documentAbsoluteIndex: 172, + documentLineIndex: 5, + documentCharacterIndex: 18, + generatedAbsoluteIndex: 2585, + generatedLineIndex: 53, + generatedCharacterIndex: 91, + contentLength: 5), }; // Act and Assert @@ -208,22 +208,22 @@ namespace Microsoft.AspNetCore.Mvc.Razor host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 13, - documentLineIndex: 0, - documentCharacterIndex: 13, - generatedAbsoluteIndex: 1269, - generatedLineIndex: 32, - generatedCharacterIndex: 13, - contentLength: 4), - BuildLineMapping( - documentAbsoluteIndex: 43, - documentLineIndex: 2, - documentCharacterIndex: 5, - generatedAbsoluteIndex: 1353, - generatedLineIndex: 37, - generatedCharacterIndex: 6, - contentLength: 21), + BuildLineMapping( + documentAbsoluteIndex: 13, + documentLineIndex: 0, + documentCharacterIndex: 13, + generatedAbsoluteIndex: 1305, + generatedLineIndex: 32, + generatedCharacterIndex: 13, + contentLength: 4), + BuildLineMapping( + documentAbsoluteIndex: 43, + documentLineIndex: 2, + documentCharacterIndex: 5, + generatedAbsoluteIndex: 1389, + generatedLineIndex: 37, + generatedCharacterIndex: 6, + contentLength: 21), }; // Act and Assert @@ -244,14 +244,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 8, - documentLineIndex: 0, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 661, - generatedLineIndex: 21, - generatedCharacterIndex: 8, - contentLength: 26), + BuildLineMapping( + documentAbsoluteIndex: 8, + documentLineIndex: 0, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 669, + generatedLineIndex: 21, + generatedCharacterIndex: 8, + contentLength: 26), }; // Act and Assert @@ -272,22 +272,22 @@ namespace Microsoft.AspNetCore.Mvc.Razor host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 1, - documentLineIndex: 0, - documentCharacterIndex: 1, - generatedAbsoluteIndex: 59, - generatedLineIndex: 3, - generatedCharacterIndex: 0, - contentLength: 17), - BuildLineMapping( - documentAbsoluteIndex: 28, - documentLineIndex: 1, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 706, - generatedLineIndex: 26, - generatedCharacterIndex: 8, - contentLength: 20), + BuildLineMapping( + documentAbsoluteIndex: 1, + documentLineIndex: 0, + documentCharacterIndex: 1, + generatedAbsoluteIndex: 59, + generatedLineIndex: 3, + generatedCharacterIndex: 0, + contentLength: 17), + BuildLineMapping( + documentAbsoluteIndex: 28, + documentLineIndex: 1, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 714, + generatedLineIndex: 26, + generatedCharacterIndex: 8, + contentLength: 20), }; // Act and Assert @@ -308,30 +308,30 @@ namespace Microsoft.AspNetCore.Mvc.Razor host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 7, - documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 391, - generatedLineIndex: 11, - generatedCharacterIndex: 28, - contentLength: 7), - BuildLineMapping( - documentAbsoluteIndex: 24, - documentLineIndex: 1, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 755, - generatedLineIndex: 25, - generatedCharacterIndex: 8, - contentLength: 20), - BuildLineMapping( - documentAbsoluteIndex: 54, - documentLineIndex: 2, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 981, - generatedLineIndex: 33, - generatedCharacterIndex: 8, - contentLength: 23), + BuildLineMapping( + documentAbsoluteIndex: 7, + documentLineIndex: 0, + documentCharacterIndex: 7, + generatedAbsoluteIndex: 395, + generatedLineIndex: 11, + generatedCharacterIndex: 28, + contentLength: 7), + BuildLineMapping( + documentAbsoluteIndex: 24, + documentLineIndex: 1, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 763, + generatedLineIndex: 25, + generatedCharacterIndex: 8, + contentLength: 20), + BuildLineMapping( + documentAbsoluteIndex: 54, + documentLineIndex: 2, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 993, + generatedLineIndex: 33, + generatedCharacterIndex: 8, + contentLength: 23), }; // Act and Assert @@ -352,46 +352,46 @@ namespace Microsoft.AspNetCore.Mvc.Razor host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 7, - documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 399, - generatedLineIndex: 11, - generatedCharacterIndex: 28, - contentLength: 7), - BuildLineMapping( - documentAbsoluteIndex: 24, - documentLineIndex: 1, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 771, - generatedLineIndex: 25, - generatedCharacterIndex: 8, - contentLength: 20), - BuildLineMapping( - documentAbsoluteIndex: 58, - documentLineIndex: 2, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 1001, - generatedLineIndex: 33, - generatedCharacterIndex: 8, - contentLength: 23), - BuildLineMapping( - documentAbsoluteIndex: 93, - documentLineIndex: 3, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 1234, - generatedLineIndex: 41, - generatedCharacterIndex: 8, - contentLength: 21), - BuildLineMapping( - documentAbsoluteIndex: 129, - documentLineIndex: 4, - documentCharacterIndex: 8, - generatedAbsoluteIndex: 1465, - generatedLineIndex: 49, - generatedCharacterIndex: 8, - contentLength: 24), + BuildLineMapping( + documentAbsoluteIndex: 7, + documentLineIndex: 0, + documentCharacterIndex: 7, + generatedAbsoluteIndex: 403, + generatedLineIndex: 11, + generatedCharacterIndex: 28, + contentLength: 7), + BuildLineMapping( + documentAbsoluteIndex: 24, + documentLineIndex: 1, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 779, + generatedLineIndex: 25, + generatedCharacterIndex: 8, + contentLength: 20), + BuildLineMapping( + documentAbsoluteIndex: 58, + documentLineIndex: 2, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 1013, + generatedLineIndex: 33, + generatedCharacterIndex: 8, + contentLength: 23), + BuildLineMapping( + documentAbsoluteIndex: 93, + documentLineIndex: 3, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 1250, + generatedLineIndex: 41, + generatedCharacterIndex: 8, + contentLength: 21), + BuildLineMapping( + documentAbsoluteIndex: 129, + documentLineIndex: 4, + documentCharacterIndex: 8, + generatedAbsoluteIndex: 1485, + generatedLineIndex: 49, + generatedCharacterIndex: 8, + contentLength: 24), }; // Act and Assert @@ -412,14 +412,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor host.NamespaceImports.Clear(); var expectedLineMappings = new[] { - BuildLineMapping( - documentAbsoluteIndex: 7, - documentLineIndex: 0, - documentCharacterIndex: 7, - generatedAbsoluteIndex: 394, - generatedLineIndex: 11, - generatedCharacterIndex: 28, - contentLength: 30), + BuildLineMapping( + documentAbsoluteIndex: 7, + documentLineIndex: 0, + documentCharacterIndex: 7, + generatedAbsoluteIndex: 398, + generatedLineIndex: 11, + generatedCharacterIndex: 28, + contentLength: 30), }; // Act and Assert diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs index 2db8cf97e3..843cd5c948 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs @@ -23,7 +23,7 @@ var __modelHelper = default(DateTime); #pragma warning restore 219 } #line hidden - private global::Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = null; + private global::Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = null; #line hidden public ASPV_testfiles_input_modelexpressiontaghelper_cshtml() { @@ -43,15 +43,15 @@ var __modelHelper = default(DateTime); #pragma warning disable 1998 public override async Task ExecuteAsync() { - __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); + __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); #line 5 "testfiles/input/modelexpressiontaghelper.cshtml" -__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now); +__Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now); #line default #line hidden - __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); + __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); #line 6 "testfiles/input/modelexpressiontaghelper.cshtml" -__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => Model); +__Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => Model); #line default #line hidden diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs index ac0b2df37b..7093db4041 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs @@ -1,4 +1,4 @@ -#pragma checksum "TestFiles/Input/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0ff475dc725132bad90d86e9458bacc73dce3df3" +#pragma checksum "TestFiles/Input/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "bb128a8b2ca348e77a9b5481e541b5a8bf82de0b" namespace Asp { using System; @@ -17,7 +17,7 @@ namespace Asp private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext __tagHelperExecutionContext = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager __tagHelperScopeManager = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperScopeManager(); - private global::Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = null; + private global::Microsoft.AspNetCore.Mvc.Razor.InputTestTagHelper __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = null; #line hidden public ASPV_TestFiles_Input_ModelExpressionTagHelper_cshtml() { @@ -38,41 +38,41 @@ namespace Asp public override async Task ExecuteAsync() { __tagHelperRunner = __tagHelperRunner ?? new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); - BeginContext(118, 2, true); + BeginContext(126, 2, true); WriteLiteral("\r\n"); EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); - __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); - __tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper); + __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper); #line 5 "TestFiles/Input/ModelExpressionTagHelper.cshtml" -__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now); +__Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => __model.Now); #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For); + __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper.For); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); - BeginContext(120, 24, false); + BeginContext(128, 24, false); Write(__tagHelperExecutionContext.Output); EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); - BeginContext(144, 2, true); + BeginContext(152, 2, true); WriteLiteral("\r\n"); EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { } , StartTagHelperWritingScope, EndTagHelperWritingScope); - __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); - __tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper); + __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper); #line 6 "TestFiles/Input/ModelExpressionTagHelper.cshtml" -__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => Model); +__Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__model => Model); #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For); + __tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNetCore_Mvc_Razor_InputTestTagHelper.For); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); - BeginContext(146, 27, false); + BeginContext(154, 27, false); Write(__tagHelperExecutionContext.Output); EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End();