From 207f40f92de9e51ba0df561872ec180927eb10d1 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Mon, 10 Apr 2017 19:22:18 -0700 Subject: [PATCH] Move test infrastructure This moves the test infrastructure to a common project and udpates the MVC tests to use the good integration testing features. --- .../MvcRazorTemplateEngine.cs | 3 +- .../CodeGenerationTests.cs | 304 ------------- .../CodeGenerationIntegrationTest.cs | 419 ++++++++++++++++++ ...spNetCore.Mvc.Razor.Extensions.Test.csproj | 2 - .../Basic.cshtml | 0 .../Basic_DesignTime.codegen.cs} | 0 .../Basic_DesignTime.ir.txt | 56 +++ .../Basic_DesignTime.mappings.txt} | 0 .../Basic_Runtime.codegen.cs} | 0 .../Basic_Runtime.ir.txt | 48 ++ .../Inject.cshtml | 0 .../InjectWithModel.cshtml | 0 .../InjectWithModel_DesignTime.codegen.cs} | 0 .../InjectWithModel_DesignTime.ir.txt | 48 ++ .../InjectWithModel_DesignTime.mappings.txt} | 0 .../InjectWithModel_Runtime.codegen.cs} | 0 .../InjectWithModel_Runtime.ir.txt | 18 + .../InjectWithSemicolon.cshtml | 0 ...InjectWithSemicolon_DesignTime.codegen.cs} | 0 .../InjectWithSemicolon_DesignTime.ir.txt | 54 +++ ...jectWithSemicolon_DesignTime.mappings.txt} | 0 .../InjectWithSemicolon_Runtime.codegen.cs} | 0 .../InjectWithSemicolon_Runtime.ir.txt | 20 + .../Inject_DesignTime.codegen.cs} | 0 .../Inject_DesignTime.ir.txt | 48 ++ .../Inject_DesignTime.mappings.txt} | 0 .../Inject_Runtime.codegen.cs} | 0 .../Inject_Runtime.ir.txt | 19 + .../Model.cshtml | 0 .../ModelExpressionTagHelper.cshtml | 0 ...ExpressionTagHelper_DesignTime.codegen.cs} | 0 ...ModelExpressionTagHelper_DesignTime.ir.txt | 72 +++ ...pressionTagHelper_DesignTime.mappings.txt} | 0 ...delExpressionTagHelper_Runtime.codegen.cs} | 0 .../ModelExpressionTagHelper_Runtime.ir.txt | 69 +++ .../Model_DesignTime.codegen.cs} | 0 .../Model_DesignTime.ir.txt | 43 ++ .../Model_DesignTime.mappings.txt} | 0 .../Model_Runtime.codegen.cs} | 0 .../Model_Runtime.ir.txt | 17 + .../MultipleModels.cshtml | 0 .../MultipleModels_DesignTime.codegen.cs} | 0 .../MultipleModels_DesignTime.ir.txt | 44 ++ .../MultipleModels_DesignTime.mappings.txt} | 0 .../RazorPages.cshtml | 0 .../RazorPagesWithoutModel.cshtml | 0 ...orPagesWithoutModel_DesignTime.codegen.cs} | 0 .../RazorPagesWithoutModel_DesignTime.ir.txt | 147 ++++++ ...PagesWithoutModel_DesignTime.mappings.txt} | 0 ...RazorPagesWithoutModel_Runtime.codegen.cs} | 0 .../RazorPagesWithoutModel_Runtime.ir.txt | 189 ++++++++ .../RazorPages_DesignTime.codegen.cs} | 0 .../RazorPages_DesignTime.ir.txt | 148 +++++++ .../RazorPages_DesignTime.mappings.txt} | 0 .../RazorPages_Runtime.codegen.cs} | 0 .../RazorPages_Runtime.ir.txt | 189 ++++++++ .../_ViewImports.cshtml | 0 .../_ViewImports_DesignTime.codegen.cs} | 0 .../_ViewImports_DesignTime.ir.txt | 45 ++ .../_ViewImports_DesignTime.mappings.txt} | 0 .../_ViewImports_Runtime.codegen.cs} | 0 .../_ViewImports_Runtime.ir.txt | 18 + .../FileSystemRazorProjectItemTest.cs | 6 +- .../FileSystemRazorProjectTest.cs | 6 +- .../CodeGenerationIntegrationTest.cs | 3 - .../Legacy/HtmlDocumentTest.cs | 2 +- .../Legacy/RazorEditorParserTest.cs | 4 +- .../Legacy/RazorParserTest.cs | 2 +- .../TestRazorCodeDocument.cs | 29 -- .../IntegrationTests/IntegrationTestBase.cs | 51 ++- .../IntializeTestFileAttribute.cs | 4 +- .../LineMappingsSerializer.cs | 0 .../IntegrationTests/RazorIRNodeSerializer.cs | 0 .../IntegrationTests/RazorIRNodeVerifier.cs | 0 .../IntegrationTests/RazorIRNodeWriter.cs | 8 +- .../TestTagHelperDescriptors.cs | 21 +- .../RazorEngineBuilderExtensions.cs | 0 .../Langauge}/TestFile.cs | 9 +- .../Langauge}/TestProject.cs | 7 +- .../Langauge/TestRazorCodeDocument.cs | 27 ++ .../{ => Langauge}/TestRazorProject.cs | 0 .../{ => Langauge}/TestRazorProjectItem.cs | 0 .../Langauge}/TestRazorSourceDocument.cs | 22 +- .../TestTagHelperDescriptorResolver.cs | 0 .../{ => Langauge}/TestTagHelperFeature.cs | 0 .../RazorPageGenerator.Test.csproj | 5 +- .../RazorPageGeneratorTest.cs | 2 +- 87 files changed, 1827 insertions(+), 401 deletions(-) delete mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/CodeGenerationTests.cs create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/IntegrationTests/CodeGenerationIntegrationTest.cs rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/Basic.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/Basic.cs => IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/Basic.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/Basic.cs => IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/Inject.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/InjectWithModel.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/InjectWithModel.cs => IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/InjectWithModel.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/InjectWithModel.cs => IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/InjectWithSemicolon.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/InjectWithSemicolon.cs => IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/InjectWithSemicolon.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/InjectWithSemicolon.cs => IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/Inject.cs => IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/Inject.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/Inject.cs => IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/Model.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/ModelExpressionTagHelper.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/ModelExpressionTagHelper.cs => IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/ModelExpressionTagHelper.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/ModelExpressionTagHelper.cs => IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/Model.cs => IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/Model.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/Model.cs => IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/MultipleModels.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/MultipleModels.cs => IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/MultipleModels.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/RazorPages.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/RazorPagesWithoutModel.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/RazorPagesWithoutModel.cs => IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/RazorPagesWithoutModel.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/RazorPagesWithoutModel.cs => IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/RazorPages.cs => IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/RazorPages.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/RazorPages.cs => IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Input => IntegrationTests/CodeGenerationIntegrationTest}/_ViewImports.cshtml (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/_ViewImports.cs => IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/DesignTime/_ViewImports.mappings.txt => IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt} (100%) rename test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/{Output/Runtime/_ViewImports.cs => IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs} (100%) create mode 100644 test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt delete mode 100644 test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorCodeDocument.cs rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/IntegrationTests/IntegrationTestBase.cs (83%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/IntegrationTests/IntializeTestFileAttribute.cs (77%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/IntegrationTests/LineMappingsSerializer.cs (100%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/IntegrationTests/RazorIRNodeSerializer.cs (100%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/IntegrationTests/RazorIRNodeVerifier.cs (100%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/IntegrationTests/RazorIRNodeWriter.cs (96%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests}/TestTagHelperDescriptors.cs (96%) rename test/Microsoft.AspNetCore.Razor.Test.Common/{ => Langauge}/RazorEngineBuilderExtensions.cs (100%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/TestFile.cs (88%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/TestProject.cs (73%) create mode 100644 test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorCodeDocument.cs rename test/Microsoft.AspNetCore.Razor.Test.Common/{ => Langauge}/TestRazorProject.cs (100%) rename test/Microsoft.AspNetCore.Razor.Test.Common/{ => Langauge}/TestRazorProjectItem.cs (100%) rename test/{Microsoft.AspNetCore.Razor.Language.Test => Microsoft.AspNetCore.Razor.Test.Common/Langauge}/TestRazorSourceDocument.cs (74%) rename test/Microsoft.AspNetCore.Razor.Test.Common/{ => Langauge}/TestTagHelperDescriptorResolver.cs (100%) rename test/Microsoft.AspNetCore.Razor.Test.Common/{ => Langauge}/TestTagHelperFeature.cs (100%) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcRazorTemplateEngine.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcRazorTemplateEngine.cs index 0729d76e56..b03080e7db 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcRazorTemplateEngine.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcRazorTemplateEngine.cs @@ -36,7 +36,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions return codeDocument; } - private static RazorSourceDocument GetDefaultImports() + // Internal for testing. + internal static RazorSourceDocument GetDefaultImports() { using (var stream = new MemoryStream()) using (var writer = new StreamWriter(stream, Encoding.UTF8)) diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/CodeGenerationTests.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/CodeGenerationTests.cs deleted file mode 100644 index 171e425065..0000000000 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/CodeGenerationTests.cs +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.TagHelpers; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.Emit; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.Extensions.DependencyModel; -using Xunit; - -namespace Microsoft.AspNetCore.Mvc.Razor.Extensions -{ - public class CodeGenerationTests - { - private static Assembly _assembly = typeof(CodeGenerationTests).GetTypeInfo().Assembly; - - #region Runtime - [Fact] - public void RazorEngine_Basic_Runtime() - { - RunRuntimeTest("Basic"); - } - - [Fact] - public void RazorEngine_ViewImports_Runtime() - { - RunRuntimeTest("_ViewImports"); - } - - [Fact] - public void RazorEngine_Inject_Runtime() - { - RunRuntimeTest("Inject"); - } - - [Fact] - public void RazorEngine_InjectWithModel_Runtime() - { - RunRuntimeTest("InjectWithModel"); - } - - [Fact] - public void RazorEngine_InjectWithSemicolon_Runtime() - { - RunRuntimeTest("InjectWithSemicolon"); - } - - [Fact] - public void RazorEngine_Model_Runtime() - { - RunRuntimeTest("Model"); - } - - [Fact] - public void RazorEngine_ModelExpressionTagHelper_Runtime() - { - RunRuntimeTest("ModelExpressionTagHelper"); - } - - [Fact] - public void RazorEngine_RazorPages_Runtime() - { - RunRuntimeTest("RazorPages", BuildDivDescriptors()); - } - - [Fact] - public void RazorEngine_RazorPagesWithoutModel_Runtime() - { - RunRuntimeTest("RazorPagesWithoutModel", BuildDivDescriptors()); - } - #endregion - - #region DesignTime - [Fact] - public void RazorEngine_Basic_DesignTime() - { - RunDesignTimeTest("Basic"); - } - - [Fact] - public void RazorEngine_ViewImports_DesignTime() - { - RunDesignTimeTest("_ViewImports"); - } - - [Fact] - public void RazorEngine_Inject_DesignTime() - { - RunDesignTimeTest("Inject"); - } - - [Fact] - public void RazorEngine_InjectWithModel_DesignTime() - { - RunDesignTimeTest("InjectWithModel"); - } - - [Fact] - public void RazorEngine_InjectWithSemicolon_DesignTime() - { - RunDesignTimeTest("InjectWithSemicolon"); - } - - [Fact] - public void RazorEngine_Model_DesignTime() - { - RunDesignTimeTest("Model"); - } - - [Fact] - public void RazorEngine_MultipleModels_DesignTime() - { - RunDesignTimeTest("MultipleModels"); - } - - [Fact] - public void RazorEngine_ModelExpressionTagHelper_DesignTime() - { - RunDesignTimeTest("ModelExpressionTagHelper"); - } - - [Fact] - public void RazorEngine_RazorPages_DesignTime() - { - RunDesignTimeTest("RazorPages", BuildDivDescriptors()); - } - - [Fact] - public void RazorEngine_RazorPagesWithoutModel_DesignTime() - { - RunDesignTimeTest("RazorPagesWithoutModel", BuildDivDescriptors()); - } - #endregion - - private static void RunRuntimeTest(string testName, IEnumerable descriptors = null) - { - // Arrange - var inputFile = "TestFiles/Input/" + testName + ".cshtml"; - var outputFile = "TestFiles/Output/Runtime/" + testName + ".cs"; - var expectedCode = ResourceFile.ReadResource(_assembly, outputFile, sourceFile: false); - - var engine = RazorEngine.Create(b => - { - RazorExtensions.Register(b); - - b.Features.Add(GetMetadataReferenceFeature()); - - if (descriptors != null) - { - b.AddTagHelpers(descriptors); - } - else - { - b.Features.Add(new DefaultTagHelperFeature()); - } - - }); - - var inputContent = ResourceFile.ReadResource(_assembly, inputFile, sourceFile: true); - var item = new TestRazorProjectItem("/" + inputFile) { Content = inputContent, }; - var project = new TestRazorProject(new List() - { - item, - }); - - var razorTemplateEngine = new MvcRazorTemplateEngine(engine, project); - razorTemplateEngine.Options.ImportsFileName = "_ViewImports.cshtml"; - var codeDocument = razorTemplateEngine.CreateCodeDocument(item); - codeDocument.Items["SuppressUniqueIds"] = "test"; - codeDocument.Items["NewLineString"] = "\r\n"; - - // Act - var csharpDocument = razorTemplateEngine.GenerateCode(codeDocument); - - // Assert - Assert.Empty(csharpDocument.Diagnostics); - -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedCode, csharpDocument.GeneratedCode); -#else - Assert.Equal(expectedCode, csharpDocument.GeneratedCode, ignoreLineEndingDifferences: true); -#endif - } - - private static void RunDesignTimeTest(string testName, IEnumerable descriptors = null) - { - // Arrange - var inputFile = "TestFiles/Input/" + testName + ".cshtml"; - var outputFile = "TestFiles/Output/DesignTime/" + testName + ".cs"; - var expectedCode = ResourceFile.ReadResource(_assembly, outputFile, sourceFile: false); - - var lineMappingOutputFile = "TestFiles/Output/DesignTime/" + testName + ".mappings.txt"; - var expectedMappings = ResourceFile.ReadResource(_assembly, lineMappingOutputFile, sourceFile: false); - - var engine = RazorEngine.CreateDesignTime(b => - { - RazorExtensions.Register(b); - - b.Features.Add(GetMetadataReferenceFeature()); - - if (descriptors != null) - { - b.AddTagHelpers(descriptors); - } - else - { - b.Features.Add(new DefaultTagHelperFeature()); - } - }); - - var inputContent = ResourceFile.ReadResource(_assembly, inputFile, sourceFile: true); - var item = new TestRazorProjectItem("/" + inputFile) { Content = inputContent, }; - var project = new TestRazorProject(new List() - { - item, - }); - - var razorTemplateEngine = new MvcRazorTemplateEngine(engine, project); - razorTemplateEngine.Options.ImportsFileName = "_ViewImports.cshtml"; - var codeDocument = razorTemplateEngine.CreateCodeDocument(item); - codeDocument.Items["SuppressUniqueIds"] = "test"; - codeDocument.Items["NewLineString"] = "\r\n"; - - // Act - var csharpDocument = razorTemplateEngine.GenerateCode(codeDocument); - - // Assert - Assert.Empty(csharpDocument.Diagnostics); - - var serializedMappings = LineMappingsSerializer.Serialize(csharpDocument, codeDocument.Source); - -#if GENERATE_BASELINES - ResourceFile.UpdateFile(_assembly, outputFile, expectedCode, csharpDocument.GeneratedCode); - ResourceFile.UpdateFile(_assembly, lineMappingOutputFile, expectedMappings, serializedMappings); -#else - Assert.Equal(expectedCode, csharpDocument.GeneratedCode, ignoreLineEndingDifferences: true); - Assert.Equal(expectedMappings, serializedMappings, ignoreLineEndingDifferences: true); -#endif - } - - private static IEnumerable BuildDivDescriptors() - { - return new List { - BuildDescriptor("div", "DivTagHelper", "TestAssembly"), - BuildDescriptor("a", "UrlResolutionTagHelper", "Microsoft.AspNetCore.Mvc.Razor") - }; - } - - private static TagHelperDescriptor BuildDescriptor( - string tagName, - string typeName, - string assemblyName) - { - return ITagHelperDescriptorBuilder.Create(typeName, assemblyName) - .TagMatchingRule(ruleBuilder => ruleBuilder.RequireTagName(tagName)) - .Build(); - } - - private static IRazorEngineFeature GetMetadataReferenceFeature() - { - var currentAssembly = typeof(CodeGenerationTests).GetTypeInfo().Assembly; - var dependencyContext = DependencyContext.Load(currentAssembly); - - var references = dependencyContext.CompileLibraries.SelectMany(l => l.ResolveReferencePaths()) - .Select(assemblyPath => MetadataReference.CreateFromFile(assemblyPath)) - .ToList(); - - var syntaxTree = CreateTagHelperSyntaxTree(); - var compilation = CSharpCompilation.Create("Microsoft.AspNetCore.Mvc.Razor", syntaxTree, references, - options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); - var stream = new MemoryStream(); - var compilationResult = compilation.Emit(stream, options: new EmitOptions()); - stream.Position = 0; - - Assert.True(compilationResult.Success); - - references.Add(MetadataReference.CreateFromStream(stream)); - - var feature = new DefaultMetadataReferenceFeature() - { - References = references, - }; - - return feature; - } - - private static IEnumerable CreateTagHelperSyntaxTree() - { - var text = $@" - public class UrlResolutionTagHelper : {typeof(TagHelper).FullName} - {{ - - }}"; - - return new SyntaxTree[] { CSharpSyntaxTree.ParseText(text) }; - } - } -} \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/IntegrationTests/CodeGenerationIntegrationTest.cs new file mode 100644 index 0000000000..931f87069f --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -0,0 +1,419 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.IntegrationTests; +using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.Emit; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.Extensions.DependencyModel; +using Xunit; + +namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests +{ + public class CodeGenerationIntegrationTest : IntegrationTestBase + { + private static readonly RazorSourceDocument DefaultImports = MvcRazorTemplateEngine.GetDefaultImports(); + + #region Runtime + + [Fact] + public void Basic_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void _ViewImports_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Inject_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void InjectWithModel_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void InjectWithSemicolon_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Model_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ModelExpressionTagHelper_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void RazorPages_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(BuildDivDescriptors()); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void RazorPagesWithoutModel_Runtime() + { + // Arrange + var engine = CreateRuntimeEngine(BuildDivDescriptors()); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + #endregion + + #region DesignTime + [Fact] + public void Basic_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void _ViewImports_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Inject_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void InjectWithModel_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void InjectWithSemicolon_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void Model_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void MultipleModels_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void ModelExpressionTagHelper_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void RazorPages_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(BuildDivDescriptors()); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + + [Fact] + public void RazorPagesWithoutModel_DesignTime() + { + // Arrange + var engine = CreateDesignTimeEngine(BuildDivDescriptors()); + var document = CreateCodeDocument(); + + // Act + engine.Process(document); + + // Assert + AssertIRMatchesBaseline(document.GetIRDocument()); + AssertCSharpDocumentMatchesBaseline(document.GetCSharpDocument()); + } + #endregion + + protected RazorEngine CreateDesignTimeEngine(IEnumerable descriptors = null) + { + return RazorEngine.CreateDesignTime(b => + { + RazorExtensions.Register(b); + + b.Features.Add(GetMetadataReferenceFeature()); + + if (descriptors != null) + { + b.AddTagHelpers(descriptors); + } + else + { + b.Features.Add(new DefaultTagHelperFeature()); + } + }); + } + + protected RazorEngine CreateRuntimeEngine(IEnumerable descriptors = null) + { + return RazorEngine.Create(b => + { + RazorExtensions.Register(b); + + b.Features.Add(GetMetadataReferenceFeature()); + + if (descriptors != null) + { + b.AddTagHelpers(descriptors); + } + else + { + b.Features.Add(new DefaultTagHelperFeature()); + } + }); + } + + protected override void OnCreatingCodeDocument(ref RazorSourceDocument source, IList imports) + { + imports.Add(DefaultImports); + } + + private static IEnumerable BuildDivDescriptors() + { + return new List + { + BuildDescriptor("div", "DivTagHelper", "TestAssembly"), + BuildDescriptor("a", "UrlResolutionTagHelper", "Microsoft.AspNetCore.Mvc.Razor") + }; + } + + private static TagHelperDescriptor BuildDescriptor( + string tagName, + string typeName, + string assemblyName) + { + return ITagHelperDescriptorBuilder.Create(typeName, assemblyName) + .TagMatchingRule(ruleBuilder => ruleBuilder.RequireTagName(tagName)) + .Build(); + } + + private static IRazorEngineFeature GetMetadataReferenceFeature() + { + var currentAssembly = typeof(CodeGenerationIntegrationTest).GetTypeInfo().Assembly; + var dependencyContext = DependencyContext.Load(currentAssembly); + + var references = dependencyContext.CompileLibraries.SelectMany(l => l.ResolveReferencePaths()) + .Select(assemblyPath => MetadataReference.CreateFromFile(assemblyPath)) + .ToList(); + + var syntaxTree = CreateTagHelperSyntaxTree(); + var compilation = CSharpCompilation.Create( + "Microsoft.AspNetCore.Mvc.Razor", + syntaxTree, + references, + options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); + + var stream = new MemoryStream(); + var compilationResult = compilation.Emit(stream, options: new EmitOptions()); + stream.Position = 0; + + Assert.True(compilationResult.Success); + + references.Add(MetadataReference.CreateFromStream(stream)); + + var feature = new DefaultMetadataReferenceFeature() + { + References = references, + }; + + return feature; + } + + private static IEnumerable CreateTagHelperSyntaxTree() + { + var text = $@" + public class UrlResolutionTagHelper : {typeof(TagHelper).FullName} + {{ + + }}"; + + return new SyntaxTree[] { CSharpSyntaxTree.ParseText(text) }; + } + } +} diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj index 1601bd998e..2708bf7281 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj @@ -6,8 +6,6 @@ netcoreapp2.0;net46 netcoreapp2.0 true - $(DefineConstants);GENERATE_BASELINES - $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES $(DefaultItemExcludes);TestFiles\** true true diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/Basic.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/Basic.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Basic.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Basic.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt new file mode 100644 index 0000000000..434fe6c4df --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt @@ -0,0 +1,56 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = global::System.Object + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (0:0,0 [4] Basic.cshtml) + RazorIRToken - (0:0,0 [4] Basic.cshtml) - Html -
+ RazorIRToken - (19:0,19 [23] Basic.cshtml) - Html - \n Hello world\n + CSharpExpression - (43:2,5 [21] Basic.cshtml) + RazorIRToken - (43:2,5 [21] Basic.cshtml) - CSharp - Html.Input("SomeKey") + HtmlContent - (64:2,26 [8] Basic.cshtml) + RazorIRToken - (64:2,26 [2] Basic.cshtml) - Html - \n + RazorIRToken - (66:3,0 [6] Basic.cshtml) - Html -
+ InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Basic.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Basic.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/Basic.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/Basic.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt new file mode 100644 index 0000000000..9d7a9c9299 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt @@ -0,0 +1,48 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(0, 4, true); + HtmlContent - (0:0,0 [4] Basic.cshtml) + RazorIRToken - (0:0,0 [4] Basic.cshtml) - Html -
+ RazorIRToken - (19:0,19 [19] Basic.cshtml) - Html - \n Hello world\n + RazorIRToken - (38:2,0 [4] Basic.cshtml) - Html - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(43, 21, false); + CSharpExpression - (43:2,5 [21] Basic.cshtml) + RazorIRToken - (43:2,5 [21] Basic.cshtml) - CSharp - Html.Input("SomeKey") + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(64, 8, true); + HtmlContent - (64:2,26 [8] Basic.cshtml) + RazorIRToken - (64:2,26 [2] Basic.cshtml) - Html - \n + RazorIRToken - (66:3,0 [6] Basic.cshtml) - Html -
+ CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/Inject.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/Inject.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/InjectWithModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/InjectWithModel.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithModel.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithModel.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt new file mode 100644 index 0000000000..a7893b4a0e --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt @@ -0,0 +1,48 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = MyModel + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (7:0,7 [7] InjectWithModel.cshtml) - MyModel + DirectiveToken - (24:1,8 [5] InjectWithModel.cshtml) - MyApp + DirectiveToken - (30:1,14 [14] InjectWithModel.cshtml) - MyPropertyName + DirectiveToken - (54:2,8 [17] InjectWithModel.cshtml) - MyService + DirectiveToken - (72:2,26 [4] InjectWithModel.cshtml) - Html + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithModel.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithModel.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/InjectWithModel.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/InjectWithModel.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt new file mode 100644 index 0000000000..90867e4d49 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt @@ -0,0 +1,18 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/InjectWithSemicolon.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/InjectWithSemicolon.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt new file mode 100644 index 0000000000..818524b04d --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt @@ -0,0 +1,54 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = MyModel + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (7:0,7 [7] InjectWithSemicolon.cshtml) - MyModel + DirectiveToken - (24:1,8 [5] InjectWithSemicolon.cshtml) - MyApp + DirectiveToken - (30:1,14 [14] InjectWithSemicolon.cshtml) - MyPropertyName + DirectiveToken - (58:2,8 [17] InjectWithSemicolon.cshtml) - MyService + DirectiveToken - (76:2,26 [4] InjectWithSemicolon.cshtml) - Html + DirectiveToken - (93:3,8 [5] InjectWithSemicolon.cshtml) - MyApp + DirectiveToken - (99:3,14 [15] InjectWithSemicolon.cshtml) - MyPropertyName2 + DirectiveToken - (129:4,8 [17] InjectWithSemicolon.cshtml) - MyService + DirectiveToken - (147:4,26 [5] InjectWithSemicolon.cshtml) - Html2 + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/InjectWithSemicolon.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/InjectWithSemicolon.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/InjectWithSemicolon.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt new file mode 100644 index 0000000000..ff19a9a6dc --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt @@ -0,0 +1,20 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Inject.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Inject.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt new file mode 100644 index 0000000000..4bd1d4c324 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt @@ -0,0 +1,48 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = global::System.Object + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingStatement - (1:0,1 [17] Inject.cshtml) - MyNamespace + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (28:1,8 [5] Inject.cshtml) - MyApp + DirectiveToken - (34:1,14 [14] Inject.cshtml) - MyPropertyName + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (18:0,18 [2] Inject.cshtml) + RazorIRToken - (18:0,18 [2] Inject.cshtml) - Html - \n + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Inject.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Inject.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/Inject.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/Inject.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt new file mode 100644 index 0000000000..eef45a3b66 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt @@ -0,0 +1,19 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingStatement - (1:0,1 [19] Inject.cshtml) - MyNamespace + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/Model.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/Model.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/ModelExpressionTagHelper.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/ModelExpressionTagHelper.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt new file mode 100644 index 0000000000..fcc7783d8a --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt @@ -0,0 +1,72 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = DateTime + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (7:0,7 [8] ModelExpressionTagHelper.cshtml) - DateTime + DirectiveToken - (33:2,14 [108] ModelExpressionTagHelper.cshtml) - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper, Microsoft.AspNetCore.Mvc.Razor.Extensions.Test + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + DeclareTagHelperFields - - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (17:1,0 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (17:1,0 [2] ModelExpressionTagHelper.cshtml) - Html - \n + HtmlContent - (141:2,122 [4] ModelExpressionTagHelper.cshtml) + RazorIRToken - (141:2,122 [4] ModelExpressionTagHelper.cshtml) - Html - \n\n + TagHelper - (145:4,0 [24] ModelExpressionTagHelper.cshtml) + InitializeTagHelperStructure - - input-test - TagMode.SelfClosing + CreateTagHelper - - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper + SetTagHelperProperty - (162:4,17 [3] ModelExpressionTagHelper.cshtml) - for - For - HtmlAttributeValueStyle.DoubleQuotes + CSharpExpression - + RazorIRToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model => + RazorIRToken - - CSharp - __model. + RazorIRToken - (162:4,17 [3] ModelExpressionTagHelper.cshtml) - CSharp - Now + RazorIRToken - - CSharp - ) + ExecuteTagHelpers - + HtmlContent - (169:4,24 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (169:4,24 [2] ModelExpressionTagHelper.cshtml) - Html - \n + TagHelper - (171:5,0 [27] ModelExpressionTagHelper.cshtml) + InitializeTagHelperStructure - - input-test - TagMode.SelfClosing + CreateTagHelper - - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper + SetTagHelperProperty - (188:5,17 [6] ModelExpressionTagHelper.cshtml) - for - For - HtmlAttributeValueStyle.DoubleQuotes + CSharpExpression - + RazorIRToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model => + RazorIRToken - (189:5,18 [5] ModelExpressionTagHelper.cshtml) - CSharp - Model + RazorIRToken - - CSharp - ) + ExecuteTagHelpers - + HtmlContent - (198:5,27 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (198:5,27 [2] ModelExpressionTagHelper.cshtml) - Html - \n + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/ModelExpressionTagHelper.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt new file mode 100644 index 0000000000..4fa593b1b4 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt @@ -0,0 +1,69 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DeclareTagHelperFields - - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(17, 2, true); + HtmlContent - (17:1,0 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (17:1,0 [2] ModelExpressionTagHelper.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(143, 2, true); + HtmlContent - (143:3,0 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (143:3,0 [2] ModelExpressionTagHelper.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (145:4,0 [24] ModelExpressionTagHelper.cshtml) + InitializeTagHelperStructure - - input-test - TagMode.SelfClosing + CreateTagHelper - - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper + SetTagHelperProperty - (162:4,17 [3] ModelExpressionTagHelper.cshtml) - for - For - HtmlAttributeValueStyle.DoubleQuotes + CSharpExpression - + RazorIRToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model => + RazorIRToken - - CSharp - __model. + RazorIRToken - (162:4,17 [3] ModelExpressionTagHelper.cshtml) - CSharp - Now + RazorIRToken - - CSharp - ) + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(145, 24, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(169, 2, true); + HtmlContent - (169:4,24 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (169:4,24 [2] ModelExpressionTagHelper.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (171:5,0 [27] ModelExpressionTagHelper.cshtml) + InitializeTagHelperStructure - - input-test - TagMode.SelfClosing + CreateTagHelper - - Microsoft.AspNetCore.Mvc.Razor.Extensions.InputTestTagHelper + SetTagHelperProperty - (188:5,17 [6] ModelExpressionTagHelper.cshtml) - for - For - HtmlAttributeValueStyle.DoubleQuotes + CSharpExpression - + RazorIRToken - - CSharp - ModelExpressionProvider.CreateModelExpression(ViewData, __model => + RazorIRToken - (189:5,18 [5] ModelExpressionTagHelper.cshtml) - CSharp - Model + RazorIRToken - - CSharp - ) + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(171, 27, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(198, 2, true); + HtmlContent - (198:5,27 [2] ModelExpressionTagHelper.cshtml) + RazorIRToken - (198:5,27 [2] ModelExpressionTagHelper.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Model.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Model.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt new file mode 100644 index 0000000000..191fd9d468 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt @@ -0,0 +1,43 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = System.Collections.IEnumerable + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (7:0,7 [30] Model.cshtml) - System.Collections.IEnumerable + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Model.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/Model.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/Model.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/Model.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt new file mode 100644 index 0000000000..39120fb04d --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt @@ -0,0 +1,17 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/MultipleModels.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/MultipleModels.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/MultipleModels.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/MultipleModels.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt new file mode 100644 index 0000000000..a769297977 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt @@ -0,0 +1,44 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = System.Collections.IEnumerable + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (7:0,7 [21] MultipleModels.cshtml) - ThisShouldBeGenerated + DirectiveToken - (37:1,7 [30] MultipleModels.cshtml) - System.Collections.IEnumerable + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/MultipleModels.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/MultipleModels.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/RazorPages.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/RazorPages.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/RazorPagesWithoutModel.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/RazorPagesWithoutModel.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPagesWithoutModel.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPagesWithoutModel.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt new file mode 100644 index 0000000000..b7b2bfa867 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt @@ -0,0 +1,147 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel_cshtml + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingStatement - (43:3,1 [41] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel_cshtml - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (23:2,14 [17] RazorPagesWithoutModel.cshtml) - "*, TestAssembly" + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + DeclareTagHelperFields - - DivTagHelper + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (7:1,0 [2] RazorPagesWithoutModel.cshtml) + RazorIRToken - (7:1,0 [2] RazorPagesWithoutModel.cshtml) - Html - \n + HtmlContent - (40:2,31 [2] RazorPagesWithoutModel.cshtml) + RazorIRToken - (40:2,31 [2] RazorPagesWithoutModel.cshtml) - Html - \n + HtmlContent - (84:3,42 [4] RazorPagesWithoutModel.cshtml) + RazorIRToken - (84:3,42 [4] RazorPagesWithoutModel.cshtml) - Html - \n\n + HtmlContent - (384:18,1 [77] RazorPagesWithoutModel.cshtml) + RazorIRToken - (384:18,1 [4] RazorPagesWithoutModel.cshtml) - Html - \n\n + RazorIRToken - (388:20,0 [4] RazorPagesWithoutModel.cshtml) - Html -

+ RazorIRToken - (392:20,4 [12] RazorPagesWithoutModel.cshtml) - Html - New Customer + RazorIRToken - (404:20,16 [5] RazorPagesWithoutModel.cshtml) - Html -

+ RazorIRToken - (409:20,21 [2] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (411:21,0 [5] RazorPagesWithoutModel.cshtml) - Html -
+ RazorIRToken - (455:21,44 [6] RazorPagesWithoutModel.cshtml) - Html - \n + TagHelper - (461:22,4 [31] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (473:22,16 [11] RazorPagesWithoutModel.cshtml) + RazorIRToken - (473:22,16 [11] RazorPagesWithoutModel.cshtml) - Html - text-danger + ExecuteTagHelpers - + HtmlContent - (492:22,35 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (492:22,35 [6] RazorPagesWithoutModel.cshtml) - Html - \n + TagHelper - (498:23,4 [237] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (522:23,28 [48] RazorPagesWithoutModel.cshtml) + RazorIRToken - (522:23,28 [10] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (532:24,8 [6] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (583:24,59 [10] RazorPagesWithoutModel.cshtml) - Html - \n + TagHelper - (593:25,8 [130] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (616:25,31 [101] RazorPagesWithoutModel.cshtml) + RazorIRToken - (616:25,31 [14] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (630:26,12 [6] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (660:26,42 [14] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (674:27,12 [5] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (700:27,38 [7] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (707:27,45 [10] RazorPagesWithoutModel.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (605:25,20 [9] RazorPagesWithoutModel.cshtml) + RazorIRToken - (605:25,20 [9] RazorPagesWithoutModel.cshtml) - Html - col-md-10 + ExecuteTagHelpers - + HtmlContent - (723:28,14 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (723:28,14 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (510:23,16 [10] RazorPagesWithoutModel.cshtml) + RazorIRToken - (510:23,16 [10] RazorPagesWithoutModel.cshtml) - Html - form-group + ExecuteTagHelpers - + HtmlContent - (735:29,10 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (735:29,10 [6] RazorPagesWithoutModel.cshtml) - Html - \n + TagHelper - (741:30,4 [174] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (765:30,28 [10] RazorPagesWithoutModel.cshtml) + RazorIRToken - (765:30,28 [10] RazorPagesWithoutModel.cshtml) - Html - \n + TagHelper - (775:31,8 [128] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (814:31,47 [83] RazorPagesWithoutModel.cshtml) + RazorIRToken - (814:31,47 [14] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (828:32,12 [7] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (887:32,71 [10] RazorPagesWithoutModel.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (787:31,20 [25] RazorPagesWithoutModel.cshtml) + RazorIRToken - (787:31,20 [25] RazorPagesWithoutModel.cshtml) - Html - col-md-offset-2 col-md-10 + ExecuteTagHelpers - + HtmlContent - (903:33,14 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (903:33,14 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (753:30,16 [10] RazorPagesWithoutModel.cshtml) + RazorIRToken - (753:30,16 [10] RazorPagesWithoutModel.cshtml) - Html - form-group + ExecuteTagHelpers - + HtmlContent - (915:34,10 [11] RazorPagesWithoutModel.cshtml) + RazorIRToken - (915:34,10 [2] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (917:35,0 [7] RazorPagesWithoutModel.cshtml) - Html -
+ RazorIRToken - (924:35,7 [2] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - (100:5,12 [283] RazorPagesWithoutModel.cshtml) + RazorIRToken - (100:5,12 [283] RazorPagesWithoutModel.cshtml) - CSharp - \n public IActionResult OnPost(Customer customer)\n {\n Name = customer.Name;\n return Redirect("~/customers/inlinepagemodels/");\n }\n\n public string Name { get; set; }\n\n public class Customer\n {\n public string Name { get; set; }\n }\n + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + CSharpStatement - + RazorIRToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; + CSharpStatement - + RazorIRToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel_cshtml Model => ViewData.Model; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPagesWithoutModel.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPagesWithoutModel.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/RazorPagesWithoutModel.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/RazorPagesWithoutModel.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt new file mode 100644 index 0000000000..49e931b53e --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt @@ -0,0 +1,189 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingStatement - (43:3,1 [43] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel_cshtml - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_1 - class - col-md-10 - HtmlAttributeValueStyle.DoubleQuotes + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 - class - form-group - HtmlAttributeValueStyle.DoubleQuotes + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_3 - class - col-md-offset-2 col-md-10 - HtmlAttributeValueStyle.DoubleQuotes + DeclareTagHelperFields - - DivTagHelper + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(7, 2, true); + HtmlContent - (7:1,0 [2] RazorPagesWithoutModel.cshtml) + RazorIRToken - (7:1,0 [2] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(86, 2, true); + HtmlContent - (86:4,0 [2] RazorPagesWithoutModel.cshtml) + RazorIRToken - (86:4,0 [2] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(386, 75, true); + HtmlContent - (386:19,0 [75] RazorPagesWithoutModel.cshtml) + RazorIRToken - (386:19,0 [2] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (388:20,0 [4] RazorPagesWithoutModel.cshtml) - Html -

+ RazorIRToken - (392:20,4 [12] RazorPagesWithoutModel.cshtml) - Html - New Customer + RazorIRToken - (404:20,16 [5] RazorPagesWithoutModel.cshtml) - Html -

+ RazorIRToken - (409:20,21 [2] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (411:21,0 [5] RazorPagesWithoutModel.cshtml) - Html -
+ RazorIRToken - (455:21,44 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (461:22,4 [31] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_0 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(461, 31, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(492, 6, true); + HtmlContent - (492:22,35 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (492:22,35 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (498:23,4 [237] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(522, 48, true); + HtmlContent - (522:23,28 [48] RazorPagesWithoutModel.cshtml) + RazorIRToken - (522:23,28 [10] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (532:24,8 [6] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (583:24,59 [10] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (593:25,8 [130] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(616, 101, true); + HtmlContent - (616:25,31 [101] RazorPagesWithoutModel.cshtml) + RazorIRToken - (616:25,31 [14] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (630:26,12 [6] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (660:26,42 [14] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (674:27,12 [5] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (700:27,38 [7] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (707:27,45 [10] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_1 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(593, 130, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(723, 6, true); + HtmlContent - (723:28,14 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (723:28,14 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(498, 237, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(735, 6, true); + HtmlContent - (735:29,10 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (735:29,10 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (741:30,4 [174] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(765, 10, true); + HtmlContent - (765:30,28 [10] RazorPagesWithoutModel.cshtml) + RazorIRToken - (765:30,28 [10] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (775:31,8 [128] RazorPagesWithoutModel.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(814, 83, true); + HtmlContent - (814:31,47 [83] RazorPagesWithoutModel.cshtml) + RazorIRToken - (814:31,47 [14] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (828:32,12 [7] RazorPagesWithoutModel.cshtml) - Html - + RazorIRToken - (887:32,71 [10] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_3 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(775, 128, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(903, 6, true); + HtmlContent - (903:33,14 [6] RazorPagesWithoutModel.cshtml) + RazorIRToken - (903:33,14 [6] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(741, 174, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(915, 11, true); + HtmlContent - (915:34,10 [11] RazorPagesWithoutModel.cshtml) + RazorIRToken - (915:34,10 [2] RazorPagesWithoutModel.cshtml) - Html - \n + RazorIRToken - (917:35,0 [7] RazorPagesWithoutModel.cshtml) - Html -
+ RazorIRToken - (924:35,7 [2] RazorPagesWithoutModel.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - (100:5,12 [283] RazorPagesWithoutModel.cshtml) + RazorIRToken - (100:5,12 [283] RazorPagesWithoutModel.cshtml) - CSharp - \n public IActionResult OnPost(Customer customer)\n {\n Name = customer.Name;\n return Redirect("~/customers/inlinepagemodels/");\n }\n\n public string Name { get; set; }\n\n public class Customer\n {\n public string Name { get; set; }\n }\n + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + CSharpStatement - + RazorIRToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; + CSharpStatement - + RazorIRToken - - CSharp - public TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel_cshtml Model => ViewData.Model; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPages.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPages.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt new file mode 100644 index 0000000000..6c82e3ad1e --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt @@ -0,0 +1,148 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = NewModel + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingStatement - (60:4,1 [41] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages_cshtml - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (16:2,7 [8] RazorPages.cshtml) - NewModel + DirectiveToken - (40:3,14 [17] RazorPages.cshtml) - "*, TestAssembly" + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + DeclareTagHelperFields - - DivTagHelper + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + HtmlContent - (7:1,0 [2] RazorPages.cshtml) + RazorIRToken - (7:1,0 [2] RazorPages.cshtml) - Html - \n + HtmlContent - (57:3,31 [2] RazorPages.cshtml) + RazorIRToken - (57:3,31 [2] RazorPages.cshtml) - Html - \n + HtmlContent - (101:4,42 [4] RazorPages.cshtml) + RazorIRToken - (101:4,42 [4] RazorPages.cshtml) - Html - \n\n + HtmlContent - (478:22,1 [78] RazorPages.cshtml) + RazorIRToken - (478:22,1 [4] RazorPages.cshtml) - Html - \n\n + RazorIRToken - (482:24,0 [4] RazorPages.cshtml) - Html -

+ RazorIRToken - (486:24,4 [12] RazorPages.cshtml) - Html - New Customer + RazorIRToken - (498:24,16 [5] RazorPages.cshtml) - Html -

+ RazorIRToken - (503:24,21 [2] RazorPages.cshtml) - Html - \n + RazorIRToken - (505:25,0 [5] RazorPages.cshtml) - Html -
+ RazorIRToken - (550:25,45 [6] RazorPages.cshtml) - Html - \n + TagHelper - (556:26,4 [31] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (568:26,16 [11] RazorPages.cshtml) + RazorIRToken - (568:26,16 [11] RazorPages.cshtml) - Html - text-danger + ExecuteTagHelpers - + HtmlContent - (587:26,35 [6] RazorPages.cshtml) + RazorIRToken - (587:26,35 [6] RazorPages.cshtml) - Html - \n + TagHelper - (593:27,4 [237] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (617:27,28 [48] RazorPages.cshtml) + RazorIRToken - (617:27,28 [10] RazorPages.cshtml) - Html - \n + RazorIRToken - (627:28,8 [6] RazorPages.cshtml) - Html - + RazorIRToken - (678:28,59 [10] RazorPages.cshtml) - Html - \n + TagHelper - (688:29,8 [130] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (711:29,31 [101] RazorPages.cshtml) + RazorIRToken - (711:29,31 [14] RazorPages.cshtml) - Html - \n + RazorIRToken - (725:30,12 [6] RazorPages.cshtml) - Html - + RazorIRToken - (755:30,42 [14] RazorPages.cshtml) - Html - \n + RazorIRToken - (769:31,12 [5] RazorPages.cshtml) - Html - + RazorIRToken - (795:31,38 [7] RazorPages.cshtml) - Html - + RazorIRToken - (802:31,45 [10] RazorPages.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (700:29,20 [9] RazorPages.cshtml) + RazorIRToken - (700:29,20 [9] RazorPages.cshtml) - Html - col-md-10 + ExecuteTagHelpers - + HtmlContent - (818:32,14 [6] RazorPages.cshtml) + RazorIRToken - (818:32,14 [6] RazorPages.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (605:27,16 [10] RazorPages.cshtml) + RazorIRToken - (605:27,16 [10] RazorPages.cshtml) - Html - form-group + ExecuteTagHelpers - + HtmlContent - (830:33,10 [6] RazorPages.cshtml) + RazorIRToken - (830:33,10 [6] RazorPages.cshtml) - Html - \n + TagHelper - (836:34,4 [174] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (860:34,28 [10] RazorPages.cshtml) + RazorIRToken - (860:34,28 [10] RazorPages.cshtml) - Html - \n + TagHelper - (870:35,8 [128] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + HtmlContent - (909:35,47 [83] RazorPages.cshtml) + RazorIRToken - (909:35,47 [14] RazorPages.cshtml) - Html - \n + RazorIRToken - (923:36,12 [7] RazorPages.cshtml) - Html - + RazorIRToken - (982:36,71 [10] RazorPages.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (882:35,20 [25] RazorPages.cshtml) + RazorIRToken - (882:35,20 [25] RazorPages.cshtml) - Html - col-md-offset-2 col-md-10 + ExecuteTagHelpers - + HtmlContent - (998:37,14 [6] RazorPages.cshtml) + RazorIRToken - (998:37,14 [6] RazorPages.cshtml) - Html - \n + CreateTagHelper - - DivTagHelper + AddTagHelperHtmlAttribute - - class - HtmlAttributeValueStyle.DoubleQuotes + HtmlContent - (848:34,16 [10] RazorPages.cshtml) + RazorIRToken - (848:34,16 [10] RazorPages.cshtml) - Html - form-group + ExecuteTagHelpers - + HtmlContent - (1010:38,10 [11] RazorPages.cshtml) + RazorIRToken - (1010:38,10 [2] RazorPages.cshtml) - Html - \n + RazorIRToken - (1012:39,0 [7] RazorPages.cshtml) - Html -
+ RazorIRToken - (1019:39,7 [2] RazorPages.cshtml) - Html - \n + CSharpStatement - (117:6,12 [360] RazorPages.cshtml) + RazorIRToken - (117:6,12 [360] RazorPages.cshtml) - CSharp - \n public class NewModel : PageModel\n {\n public IActionResult OnPost(Customer customer)\n {\n Name = customer.Name;\n return Redirect("~/customers/inlinepagemodels/");\n }\n\n public string Name { get; set; }\n }\n\n public class Customer\n {\n public string Name { get; set; }\n }\n + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + CSharpStatement - + RazorIRToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; + CSharpStatement - + RazorIRToken - - CSharp - public NewModel Model => ViewData.Model; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPages.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/RazorPages.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/RazorPages.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/RazorPages.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt new file mode 100644 index 0000000000..c2b67adb1e --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt @@ -0,0 +1,189 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + UsingStatement - (60:4,1 [43] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages_cshtml - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_1 - class - col-md-10 - HtmlAttributeValueStyle.DoubleQuotes + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 - class - form-group - HtmlAttributeValueStyle.DoubleQuotes + DeclarePreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_3 - class - col-md-offset-2 col-md-10 - HtmlAttributeValueStyle.DoubleQuotes + DeclareTagHelperFields - - DivTagHelper + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(7, 2, true); + HtmlContent - (7:1,0 [2] RazorPages.cshtml) + RazorIRToken - (7:1,0 [2] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(103, 2, true); + HtmlContent - (103:5,0 [2] RazorPages.cshtml) + RazorIRToken - (103:5,0 [2] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(480, 76, true); + HtmlContent - (480:23,0 [76] RazorPages.cshtml) + RazorIRToken - (480:23,0 [2] RazorPages.cshtml) - Html - \n + RazorIRToken - (482:24,0 [4] RazorPages.cshtml) - Html -

+ RazorIRToken - (486:24,4 [12] RazorPages.cshtml) - Html - New Customer + RazorIRToken - (498:24,16 [5] RazorPages.cshtml) - Html -

+ RazorIRToken - (503:24,21 [2] RazorPages.cshtml) - Html - \n + RazorIRToken - (505:25,0 [5] RazorPages.cshtml) - Html -
+ RazorIRToken - (550:25,45 [6] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (556:26,4 [31] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_0 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(556, 31, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(587, 6, true); + HtmlContent - (587:26,35 [6] RazorPages.cshtml) + RazorIRToken - (587:26,35 [6] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (593:27,4 [237] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(617, 48, true); + HtmlContent - (617:27,28 [48] RazorPages.cshtml) + RazorIRToken - (617:27,28 [10] RazorPages.cshtml) - Html - \n + RazorIRToken - (627:28,8 [6] RazorPages.cshtml) - Html - + RazorIRToken - (678:28,59 [10] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (688:29,8 [130] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(711, 101, true); + HtmlContent - (711:29,31 [101] RazorPages.cshtml) + RazorIRToken - (711:29,31 [14] RazorPages.cshtml) - Html - \n + RazorIRToken - (725:30,12 [6] RazorPages.cshtml) - Html - + RazorIRToken - (755:30,42 [14] RazorPages.cshtml) - Html - \n + RazorIRToken - (769:31,12 [5] RazorPages.cshtml) - Html - + RazorIRToken - (795:31,38 [7] RazorPages.cshtml) - Html - + RazorIRToken - (802:31,45 [10] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_1 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(688, 130, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(818, 6, true); + HtmlContent - (818:32,14 [6] RazorPages.cshtml) + RazorIRToken - (818:32,14 [6] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(593, 237, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(830, 6, true); + HtmlContent - (830:33,10 [6] RazorPages.cshtml) + RazorIRToken - (830:33,10 [6] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (836:34,4 [174] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(860, 10, true); + HtmlContent - (860:34,28 [10] RazorPages.cshtml) + RazorIRToken - (860:34,28 [10] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + TagHelper - (870:35,8 [128] RazorPages.cshtml) + InitializeTagHelperStructure - - div - TagMode.StartTagAndEndTag + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(909, 83, true); + HtmlContent - (909:35,47 [83] RazorPages.cshtml) + RazorIRToken - (909:35,47 [14] RazorPages.cshtml) - Html - \n + RazorIRToken - (923:36,12 [7] RazorPages.cshtml) - Html - + RazorIRToken - (982:36,71 [10] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_3 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(870, 128, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(998, 6, true); + HtmlContent - (998:37,14 [6] RazorPages.cshtml) + RazorIRToken - (998:37,14 [6] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CreateTagHelper - - DivTagHelper + AddPreallocatedTagHelperHtmlAttribute - - __tagHelperAttribute_2 + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(836, 174, false); + ExecuteTagHelpers - + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - + RazorIRToken - - CSharp - BeginContext(1010, 11, true); + HtmlContent - (1010:38,10 [11] RazorPages.cshtml) + RazorIRToken - (1010:38,10 [2] RazorPages.cshtml) - Html - \n + RazorIRToken - (1012:39,0 [7] RazorPages.cshtml) - Html -
+ RazorIRToken - (1019:39,7 [2] RazorPages.cshtml) - Html - \n + CSharpStatement - + RazorIRToken - - CSharp - EndContext(); + CSharpStatement - (117:6,12 [360] RazorPages.cshtml) + RazorIRToken - (117:6,12 [360] RazorPages.cshtml) - CSharp - \n public class NewModel : PageModel\n {\n public IActionResult OnPost(Customer customer)\n {\n Name = customer.Name;\n return Redirect("~/customers/inlinepagemodels/");\n }\n\n public string Name { get; set; }\n }\n\n public class Customer\n {\n public string Name { get; set; }\n }\n + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + CSharpStatement - + RazorIRToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; + CSharpStatement - + RazorIRToken - - CSharp - public NewModel Model => ViewData.Model; diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/_ViewImports.cshtml b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Input/_ViewImports.cshtml rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/_ViewImports.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/_ViewImports.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt new file mode 100644 index 0000000000..da033f8e92 --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt @@ -0,0 +1,45 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - - TModel = global::System.Object + UsingStatement - (1:0,1 [12] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [17] ) - System.Linq + UsingStatement - (36:2,1 [32] ) - System.Collections.Generic + UsingStatement - (71:3,1 [30] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [40] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [43] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + DirectiveTokenHelper - + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning disable 219 + CSharpStatement - + RazorIRToken - - CSharp - private void __RazorDirectiveTokenHelpers__() { + DirectiveToken - (200:6,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper + DirectiveToken - (263:6,71 [4] ) - Html + DirectiveToken - (277:7,8 [54] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper + DirectiveToken - (332:7,63 [4] ) - Json + DirectiveToken - (346:8,8 [53] ) - global::Microsoft.AspNetCore.Mvc.IViewComponentHelper + DirectiveToken - (400:8,62 [9] ) - Component + DirectiveToken - (419:9,8 [43] ) - global::Microsoft.AspNetCore.Mvc.IUrlHelper + DirectiveToken - (463:9,52 [3] ) - Url + DirectiveToken - (476:10,8 [70] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider + DirectiveToken - (547:10,79 [23] ) - ModelExpressionProvider + DirectiveToken - (586:11,14 [96] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (698:12,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (801:13,14 [87] ) - Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor + DirectiveToken - (8:0,8 [19] _ViewImports.cshtml) - IHtmlHelper + DirectiveToken - (28:0,28 [5] _ViewImports.cshtml) - Model + CSharpStatement - + RazorIRToken - - CSharp - } + CSharpStatement - + RazorIRToken - - CSharp - #pragma warning restore 219 + CSharpStatement - + RazorIRToken - - CSharp - private static System.Object __o = null; + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/_ViewImports.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/DesignTime/_ViewImports.mappings.txt rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/_ViewImports.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs similarity index 100% rename from test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/Output/Runtime/_ViewImports.cs rename to test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt new file mode 100644 index 0000000000..224e2acb3a --- /dev/null +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt @@ -0,0 +1,18 @@ +Document - + Checksum - + NamespaceDeclaration - - AspNetCore + UsingStatement - (1:0,1 [14] ) - System + UsingStatement - - System.Threading.Tasks + UsingStatement - (16:1,1 [19] ) - System.Linq + UsingStatement - (36:2,1 [34] ) - System.Collections.Generic + UsingStatement - (71:3,1 [32] ) - Microsoft.AspNetCore.Mvc + UsingStatement - (104:4,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering + UsingStatement - (147:5,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorMethodDeclaration - - public - async, override - global::System.Threading.Tasks.Task - ExecuteAsync + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - + InjectDirective - diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectItemTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectItemTest.cs index 9838c72f9d..b1508e3802 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectItemTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectItemTest.cs @@ -8,8 +8,10 @@ namespace Microsoft.AspNetCore.Razor.Language { public class FileSystemRazorProjectItemTest { - private static string TestFolder { get; } = - Path.Combine(TestProject.GetProjectDirectory(), "TestFiles", "FileSystemRazorProject"); + private static string TestFolder { get; } = Path.Combine( + TestProject.GetProjectDirectory(typeof(FileSystemRazorProjectItemTest)), + "TestFiles", + "FileSystemRazorProject"); [Fact] public void FileSystemRazorProjectItem_SetsProperties() diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectTest.cs index 52f90d2590..5ee4ea9d9b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/FileSystemRazorProjectTest.cs @@ -10,8 +10,10 @@ namespace Microsoft.AspNetCore.Razor.Language { public class FileSystemRazorProjectTest { - private static string TestFolder { get; } = - Path.Combine(TestProject.GetProjectDirectory(), "TestFiles", "FileSystemRazorProject"); + private static string TestFolder { get; } = Path.Combine( + TestProject.GetProjectDirectory(typeof(FileSystemRazorProjectTest)), + "TestFiles", + "FileSystemRazorProject"); [Theory] [InlineData(null)] diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs index e503925d93..76d51b00ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -1,11 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; -using System.IO; using Xunit; -using Xunit.Sdk; namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs index db424cdd1d..00fe7ca003 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlDocumentTest.cs @@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { public class HtmlDocumentTest : CsHtmlMarkupParserTestBase { - private static readonly TestFile Nested1000 = TestFile.Create("TestFiles/nested-1000.html"); + private static readonly TestFile Nested1000 = TestFile.Create("TestFiles/nested-1000.html", typeof(HtmlDocumentTest)); [Fact] public void ParseDocument_NestedCodeBlockWithMarkupSetsDotAsMarkup() diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorEditorParserTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorEditorParserTest.cs index 9be4822c2d..b1038b63ce 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorEditorParserTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorEditorParserTest.cs @@ -11,8 +11,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { public class RazorEditorParserTest { - private static readonly TestFile SimpleCSHTMLDocument = TestFile.Create("TestFiles/DesignTime/Simple.cshtml"); - private static readonly TestFile SimpleCSHTMLDocumentGenerated = TestFile.Create("TestFiles/DesignTime/Simple.txt"); + private static readonly TestFile SimpleCSHTMLDocument = TestFile.Create("TestFiles/DesignTime/Simple.cshtml", typeof(RazorEditorParserTest)); + private static readonly TestFile SimpleCSHTMLDocumentGenerated = TestFile.Create("TestFiles/DesignTime/Simple.txt", typeof(RazorEditorParserTest)); private const string TestLinePragmaFileName = "C:\\This\\Path\\Is\\Just\\For\\Line\\Pragmas.cshtml"; public static TheoryData TagHelperPartialParseRejectData diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs index 3dcbbbc555..9351779a28 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void CanParseStuff() { var parser = new RazorParser(); - var sourceDocument = TestRazorSourceDocument.CreateResource("TestFiles/Source/BasicMarkup.cshtml"); + var sourceDocument = TestRazorSourceDocument.CreateResource("TestFiles/Source/BasicMarkup.cshtml", GetType()); var output = parser.Parse(sourceDocument); Assert.NotNull(output); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorCodeDocument.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorCodeDocument.cs deleted file mode 100644 index 88e35ec4e6..0000000000 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorCodeDocument.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Razor.Language -{ - internal class TestRazorCodeDocument : DefaultRazorCodeDocument - { - public static TestRazorCodeDocument CreateEmpty() - { - var source = TestRazorSourceDocument.Create(content: string.Empty); - return new TestRazorCodeDocument(source, imports: null); - } - - public static TestRazorCodeDocument Create(string content) - { - var source = TestRazorSourceDocument.Create(content); - return new TestRazorCodeDocument(source, imports: null); - } - - private TestRazorCodeDocument( - RazorSourceDocument source, - IEnumerable imports) - : base(source, imports) - { - } - } -} diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/IntegrationTestBase.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/IntegrationTestBase.cs similarity index 83% rename from test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/IntegrationTestBase.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/IntegrationTestBase.cs index b03fcf6816..2b2e5a3a70 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/IntegrationTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/IntegrationTestBase.cs @@ -21,17 +21,22 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests [IntializeTestFile] public abstract class IntegrationTestBase { -#if GENERATE_BASELINES - private static readonly bool GenerateBaselines = true; -#else - private static readonly bool GenerateBaselines = false; -#endif - #if !NET452 private static readonly AsyncLocal _filename = new AsyncLocal(); #endif - protected static string TestProjectRoot { get; } = TestProject.GetProjectDirectory(); + protected IntegrationTestBase() + { + TestProjectRoot = TestProject.GetProjectDirectory(GetType()); + } + +#if GENERATE_BASELINES + protected bool GenerateBaselines { get; set; } = true; +#else + protected bool GenerateBaselines { get; set; } = false; +#endif + + protected string TestProjectRoot { get; } // Used by the test framework to set the 'base' name for test files. public static string Filename @@ -63,27 +68,29 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests var suffixIndex = Filename.LastIndexOf("_"); var normalizedFileName = suffixIndex == -1 ? Filename : Filename.Substring(0, suffixIndex); var sourceFilename = Path.ChangeExtension(normalizedFileName, ".cshtml"); - var testFile = TestFile.Create(sourceFilename); + var testFile = TestFile.Create(sourceFilename, GetType().GetTypeInfo().Assembly); if (!testFile.Exists()) { throw new XunitException($"The resource {sourceFilename} was not found."); } + var source = TestRazorSourceDocument.CreateResource(sourceFilename, GetType(), normalizeNewLines: true); + var imports = new List(); while (true) { var importsFilename = Path.ChangeExtension(normalizedFileName + "_Imports" + imports.Count.ToString(), ".cshtml"); - if (!TestFile.Create(importsFilename).Exists()) + if (!TestFile.Create(importsFilename, GetType().GetTypeInfo().Assembly).Exists()) { break; } - imports.Add( - TestRazorSourceDocument.CreateResource(importsFilename, encoding: null, normalizeNewLines: true)); + imports.Add(TestRazorSourceDocument.CreateResource(importsFilename, GetType(), normalizeNewLines: true)); } - var codeDocument = RazorCodeDocument.Create( - TestRazorSourceDocument.CreateResource(sourceFilename, encoding: null, normalizeNewLines: true), imports); + OnCreatingCodeDocument(ref source, imports); + + var codeDocument = RazorCodeDocument.Create(source, imports); // This will ensure that we're not putting any randomly generated data in a baseline. codeDocument.Items[DefaultRazorCSharpLoweringPhase.SuppressUniqueIds] = "test"; @@ -91,9 +98,19 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests // This is to make tests work cross platform. codeDocument.Items[DefaultRazorCSharpLoweringPhase.NewLineString] = "\r\n"; + OnCreatedCodeDocument(ref codeDocument); + return codeDocument; } + protected virtual void OnCreatingCodeDocument(ref RazorSourceDocument source, IList imports) + { + } + + protected virtual void OnCreatedCodeDocument(ref RazorCodeDocument codeDocument) + { + } + protected void AssertIRMatchesBaseline(DocumentIRNode document) { if (Filename == null) @@ -111,7 +128,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests return; } - var testFile = TestFile.Create(baselineFilename); + var testFile = TestFile.Create(baselineFilename, GetType().GetTypeInfo().Assembly); if (!testFile.Exists()) { throw new XunitException($"The resource {baselineFilename} was not found."); @@ -138,7 +155,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests return; } - var testFile = TestFile.Create(baselineFilename); + var testFile = TestFile.Create(baselineFilename, GetType().GetTypeInfo().Assembly); if (!testFile.Exists()) { throw new XunitException($"The resource {baselineFilename} was not found."); @@ -180,7 +197,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests return; } - var testFile = TestFile.Create(baselineFilename); + var testFile = TestFile.Create(baselineFilename, GetType().GetTypeInfo().Assembly); if (!testFile.Exists()) { throw new XunitException($"The resource {baselineFilename} was not found."); @@ -214,7 +231,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests public override void VisitNamespace(NamespaceDeclarationIRNode node) { - node.Content = typeof(CodeGenerationIntegrationTest).Namespace + ".TestFiles"; + node.Content = "Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles"; VisitDefault(node); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/IntializeTestFileAttribute.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/IntializeTestFileAttribute.cs similarity index 77% rename from test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/IntializeTestFileAttribute.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/IntializeTestFileAttribute.cs index 0ed743f392..07af1182c8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/IntializeTestFileAttribute.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/IntializeTestFileAttribute.cs @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests { public override void Before(MethodInfo methodUnderTest) { - if (typeof(IntegrationTestBase).IsAssignableFrom(methodUnderTest.DeclaringType)) + if (typeof(IntegrationTestBase).GetTypeInfo().IsAssignableFrom(methodUnderTest.DeclaringType.GetTypeInfo())) { var typeName = methodUnderTest.DeclaringType.Name; IntegrationTestBase.Filename = $"TestFiles/IntegrationTests/{typeName}/{methodUnderTest.Name}"; @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests public override void After(MethodInfo methodUnderTest) { - if (typeof(IntegrationTestBase).IsAssignableFrom(methodUnderTest.DeclaringType)) + if (typeof(IntegrationTestBase).GetTypeInfo().IsAssignableFrom(methodUnderTest.DeclaringType.GetTypeInfo())) { IntegrationTestBase.Filename = null; } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/LineMappingsSerializer.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/LineMappingsSerializer.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/LineMappingsSerializer.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/LineMappingsSerializer.cs diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeSerializer.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeSerializer.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeSerializer.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeSerializer.cs diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeVerifier.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeVerifier.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeVerifier.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeVerifier.cs diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeWriter.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeWriter.cs similarity index 96% rename from test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeWriter.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeWriter.cs index 2bb74625cd..8605fb23a2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/RazorIRNodeWriter.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/RazorIRNodeWriter.cs @@ -192,8 +192,12 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests _writer.Write(sourceRange.Length); _writer.Write("] "); - var fileName = sourceRange.FilePath.Substring(sourceRange.FilePath.LastIndexOf('/') + 1); - _writer.Write(fileName); + if (sourceRange.FilePath != null) + { + var fileName = sourceRange.FilePath.Substring(sourceRange.FilePath.LastIndexOf('/') + 1); + _writer.Write(fileName); + } + _writer.Write(")"); } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestTagHelperDescriptors.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/TestTagHelperDescriptors.cs similarity index 96% rename from test/Microsoft.AspNetCore.Razor.Language.Test/TestTagHelperDescriptors.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/TestTagHelperDescriptors.cs index e1fe71adff..ad40972883 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestTagHelperDescriptors.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/IntegrationTests/TestTagHelperDescriptors.cs @@ -4,13 +4,12 @@ using System; using System.Collections.Generic; using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests { public class TestTagHelperDescriptors { - internal static IEnumerable SimpleTagHelperDescriptors + public static IEnumerable SimpleTagHelperDescriptors { get { @@ -43,7 +42,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable CssSelectorTagHelperDescriptors + public static IEnumerable CssSelectorTagHelperDescriptors { get { @@ -143,7 +142,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable EnumTagHelperDescriptors + public static IEnumerable EnumTagHelperDescriptors { get { @@ -177,7 +176,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable SymbolBoundTagHelperDescriptors + public static IEnumerable SymbolBoundTagHelperDescriptors { get { @@ -222,7 +221,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable MinimizedTagHelpers_Descriptors + public static IEnumerable MinimizedTagHelpers_Descriptors { get { @@ -268,7 +267,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable DynamicAttributeTagHelpers_Descriptors + public static IEnumerable DynamicAttributeTagHelpers_Descriptors { get { @@ -289,7 +288,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable AttributeTargetingTagHelperDescriptors + public static IEnumerable AttributeTargetingTagHelperDescriptors { get { @@ -344,7 +343,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable PrefixedAttributeTagHelperDescriptors + public static IEnumerable PrefixedAttributeTagHelperDescriptors { get { @@ -396,7 +395,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable TagHelpersInSectionDescriptors + public static IEnumerable TagHelpersInSectionDescriptors { get { @@ -419,7 +418,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests } } - internal static IEnumerable DefaultPAndInputTagHelperDescriptors + public static IEnumerable DefaultPAndInputTagHelperDescriptors { get { diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/RazorEngineBuilderExtensions.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/RazorEngineBuilderExtensions.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Test.Common/RazorEngineBuilderExtensions.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/RazorEngineBuilderExtensions.cs diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFile.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestFile.cs similarity index 88% rename from test/Microsoft.AspNetCore.Razor.Language.Test/TestFile.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestFile.cs index 5da969e1e8..c04b9243ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFile.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestFile.cs @@ -20,9 +20,14 @@ namespace Microsoft.AspNetCore.Razor.Language public string ResourceName { get; } - public static TestFile Create(string resourceName) + public static TestFile Create(string resourceName, Type type) { - return new TestFile(resourceName, typeof(TestFile).GetTypeInfo().Assembly); + return new TestFile(resourceName, type.GetTypeInfo().Assembly); + } + + public static TestFile Create(string resourceName, Assembly assembly) + { + return new TestFile(resourceName, assembly); } public Stream OpenRead() diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestProject.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestProject.cs similarity index 73% rename from test/Microsoft.AspNetCore.Razor.Language.Test/TestProject.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestProject.cs index 457d88b78e..734e8cb46e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestProject.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestProject.cs @@ -9,9 +9,7 @@ namespace Microsoft.AspNetCore.Razor.Language { public static class TestProject { - private static readonly string ThisProjectName = typeof(TestProject).GetTypeInfo().Assembly.GetName().Name; - - public static string GetProjectDirectory() + public static string GetProjectDirectory(Type type) { #if NET452 @@ -19,9 +17,10 @@ namespace Microsoft.AspNetCore.Razor.Language #else var currentDirectory = new DirectoryInfo(AppContext.BaseDirectory); #endif + var name = type.GetTypeInfo().Assembly.GetName().Name; while (currentDirectory != null && - !string.Equals(currentDirectory.Name, ThisProjectName, StringComparison.Ordinal)) + !string.Equals(currentDirectory.Name, name, StringComparison.Ordinal)) { currentDirectory = currentDirectory.Parent; } diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorCodeDocument.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorCodeDocument.cs new file mode 100644 index 0000000000..4a6430d618 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorCodeDocument.cs @@ -0,0 +1,27 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Language +{ + public static class TestRazorCodeDocument + { + public static RazorCodeDocument CreateEmpty() + { + var source = TestRazorSourceDocument.Create(content: string.Empty); + return new DefaultRazorCodeDocument(source, imports: null); + } + + public static RazorCodeDocument Create(string content) + { + var source = TestRazorSourceDocument.Create(content); + return new DefaultRazorCodeDocument(source, imports: null); + } + + public static RazorCodeDocument Create(RazorSourceDocument source, IEnumerable imports) + { + return new DefaultRazorCodeDocument(source, imports); + } + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/TestRazorProject.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorProject.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Test.Common/TestRazorProject.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorProject.cs diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/TestRazorProjectItem.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorProjectItem.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Test.Common/TestRazorProjectItem.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorProjectItem.cs diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorSourceDocument.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorSourceDocument.cs similarity index 74% rename from test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorSourceDocument.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorSourceDocument.cs index 5e936b9658..9b356adcc4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestRazorSourceDocument.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestRazorSourceDocument.cs @@ -1,24 +1,24 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System.IO; -using System.Text; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; using System; +using System.IO; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; namespace Microsoft.AspNetCore.Razor.Language { - internal class TestRazorSourceDocument : DefaultRazorSourceDocument + public static class TestRazorSourceDocument { - private TestRazorSourceDocument(string content, Encoding encoding, string filename) - : base(content, encoding, filename) + public static RazorSourceDocument CreateResource(string path, Type type, Encoding encoding = null, bool normalizeNewLines = false) { + return CreateResource(path, type.GetTypeInfo().Assembly, encoding, normalizeNewLines); } - public static RazorSourceDocument CreateResource(string path, Encoding encoding = null, bool normalizeNewLines = false) + public static RazorSourceDocument CreateResource(string path, Assembly assembly, Encoding encoding = null, bool normalizeNewLines = false) { - var file = TestFile.Create(path); + var file = TestFile.Create(path, assembly); using (var input = file.OpenRead()) using (var reader = new StreamReader(input)) @@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Razor.Language content = NormalizeNewLines(content); } - return new TestRazorSourceDocument(content, encoding ?? Encoding.UTF8, path); + return new DefaultRazorSourceDocument(content, encoding ?? Encoding.UTF8, path); } } @@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Razor.Language content = NormalizeNewLines(content); } - return new TestRazorSourceDocument(content, encoding ?? Encoding.UTF8, fileName); + return new DefaultRazorSourceDocument(content, encoding ?? Encoding.UTF8, fileName); } private static string NormalizeNewLines(string content) diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/TestTagHelperDescriptorResolver.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestTagHelperDescriptorResolver.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Test.Common/TestTagHelperDescriptorResolver.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestTagHelperDescriptorResolver.cs diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/TestTagHelperFeature.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestTagHelperFeature.cs similarity index 100% rename from test/Microsoft.AspNetCore.Razor.Test.Common/TestTagHelperFeature.cs rename to test/Microsoft.AspNetCore.Razor.Test.Common/Langauge/TestTagHelperFeature.cs diff --git a/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj b/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj index 17b29a4dac..16a3e3071e 100644 --- a/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj +++ b/test/RazorPageGenerator.Test/RazorPageGenerator.Test.csproj @@ -8,12 +8,9 @@ $(DefaultItemExcludes);TestFiles\**\* - - - - + diff --git a/test/RazorPageGenerator.Test/RazorPageGeneratorTest.cs b/test/RazorPageGenerator.Test/RazorPageGeneratorTest.cs index a981c15aa4..85e8af5b31 100644 --- a/test/RazorPageGenerator.Test/RazorPageGeneratorTest.cs +++ b/test/RazorPageGenerator.Test/RazorPageGeneratorTest.cs @@ -34,7 +34,7 @@ namespace RazorPageGenerator.Test public void Generator_GeneratesCodeForFilesIntheViewsDirectory() { // Arrange - var projectDirectory = TestProject.GetProjectDirectory(); + var projectDirectory = TestProject.GetProjectDirectory(GetType()); // Act