Skip to content

Commit

Permalink
Use Basic.Reference.Assemblies in Mvc Extension tests (dotnet#10888)
Browse files Browse the repository at this point in the history
* Use Basic.Reference.Assemblies in Mvc Extension tests

* Remove unused shim projects
  • Loading branch information
jjonescz authored Sep 17, 2024
1 parent c38fc3b commit 4467256
Show file tree
Hide file tree
Showing 13 changed files with 272 additions and 326 deletions.
1 change: 0 additions & 1 deletion Razor.Slim.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"src\\Compiler\\Microsoft.Net.Compilers.Razor.Toolset\\Microsoft.Net.Compilers.Razor.Toolset.csproj",
"src\\Compiler\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.Compiler.csproj",
"src\\Compiler\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.Compiler.csproj",
"src\\Compiler\\test\\Microsoft.AspNetCore.Razor.Test.MvcShim\\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj",
"src\\Compiler\\test\\Microsoft.NET.Sdk.Razor.SourceGenerators.Tests\\Microsoft.NET.Sdk.Razor.SourceGenerators.Test.csproj",
"src\\Compiler\\tools\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal\\Microsoft.AspNetCore.Mvc.Razor.Extensions.Tooling.Internal.csproj",
"src\\Compiler\\tools\\Microsoft.CodeAnalysis.Razor.Tooling.Internal\\Microsoft.CodeAnalysis.Razor.Tooling.Internal.csproj",
Expand Down
22 changes: 0 additions & 22 deletions Razor.sln
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Razor.Sou
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Razor.SourceGenerators.Test", "src\Compiler\test\Microsoft.NET.Sdk.Razor.SourceGenerators.Tests\Microsoft.NET.Sdk.Razor.SourceGenerators.Test.csproj", "{BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj", "{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib\Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib.Compiler.csproj", "{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.Compiler.csproj", "{A0867F6B-3DBB-4743-B241-F59878BFA15D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.Compiler", "src\Compiler\test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X.Compiler.csproj", "{B040B919-D8E3-4656-BD85-88A541AA893D}"
Expand Down Expand Up @@ -410,22 +406,6 @@ Global
{BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}.Release|Any CPU.Build.0 = Release|Any CPU
{BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{BD96BB0F-84DE-4A5F-8832-C8EADA36F43A}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.Release|Any CPU.Build.0 = Release|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.Release|Any CPU.Build.0 = Release|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU
{A0867F6B-3DBB-4743-B241-F59878BFA15D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0867F6B-3DBB-4743-B241-F59878BFA15D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0867F6B-3DBB-4743-B241-F59878BFA15D}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -660,8 +640,6 @@ Global
{FB7C870E-A173-4F75-BE63-4EF39C79A759} = {5B60F564-4AD7-4B70-A887-7D91496799A2}
{F5017FD5-EA78-4CD2-A1B6-F534910683F8} = {AA4EE974-E765-4B97-AF35-F734BF9830F6}
{BD96BB0F-84DE-4A5F-8832-C8EADA36F43A} = {AA4EE974-E765-4B97-AF35-F734BF9830F6}
{2CB7D554-49CE-45AC-97DF-7F8C597BDFA7} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3}
{9FE4A38F-F0E7-45BD-94C1-1DC6FA55BB4A} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3}
{A0867F6B-3DBB-4743-B241-F59878BFA15D} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3}
{B040B919-D8E3-4656-BD85-88A541AA893D} = {A5E2E4FA-6087-4C16-BB7A-89E23AA0F4E3}
{907EDA43-B4D9-40DA-BA07-8E00DD89FA33} = {FB7C870E-A173-4F75-BE63-4EF39C79A759}
Expand Down
2 changes: 1 addition & 1 deletion docs/ProjectsAndLayering.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ target the broadest set of frameworks.
- Microsoft.AspNetCore.Razor.Test.MvcShim (`net8.0`;`net472`)
- Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib (`netstandard2.0`)
- Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X (`net8.0`;`net472`)
- Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X (`net8.0`;`net4720`)
- Microsoft.AspNetCore.Razor.Test.MvcShim.Version2_X (`net8.0`;`net472`)

### Tooling Core Tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Linq;
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.Test.Utilities;
Expand All @@ -17,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests;

public class CodeGenerationIntegrationTest : IntegrationTestBase
{
private static readonly CSharpCompilation DefaultBaseCompilation = MvcShim.BaseCompilation.WithAssemblyName("AppCode");
private static readonly CSharpCompilation DefaultBaseCompilation = TestCompilation.Create().WithAssemblyName("AppCode");

private RazorConfiguration _configuration;

Expand Down Expand Up @@ -239,11 +238,11 @@ public void BasicComponent_Runtime()
public void Sections_Runtime()
{
// Arrange
AddCSharpSyntaxTree($$"""
AddCSharpSyntaxTree("""
using Microsoft.AspNetCore.Mvc.ViewFeatures;
public class InputTestTagHelper : {{typeof(TagHelper).FullName}}
public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public ModelExpression For { get; set; }
}
Expand Down Expand Up @@ -389,10 +388,10 @@ public void Model_Runtime()
public void ModelExpressionTagHelper_Runtime()
{
// Arrange
AddCSharpSyntaxTree($$"""
AddCSharpSyntaxTree("""
using Microsoft.AspNetCore.Mvc.ViewFeatures;
public class InputTestTagHelper : {{typeof(TagHelper).FullName}}
public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public ModelExpression For { get; set; }
}
Expand All @@ -413,8 +412,8 @@ public class InputTestTagHelper : {{typeof(TagHelper).FullName}}
public void RazorPages_Runtime()
{
// Arrange
AddCSharpSyntaxTree($$"""
public class DivTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
Expand Down Expand Up @@ -450,8 +449,8 @@ public void RazorPagesWithRouteTemplate_Runtime()
public void RazorPagesWithoutModel_Runtime()
{
// Arrange
AddCSharpSyntaxTree($$"""
public class DivTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
Expand Down Expand Up @@ -502,7 +501,7 @@ public void ViewWithNamespace_Runtime()
public void ViewComponentTagHelper_Runtime()
{
// Arrange
AddCSharpSyntaxTree($$"""
AddCSharpSyntaxTree("""
public class TestViewComponent
{
public string Invoke(string firstName)
Expand All @@ -511,8 +510,8 @@ public string Invoke(string firstName)
}
}
[{{typeof(HtmlTargetElementAttribute).FullName}}]
public class AllTagHelper : {{typeof(TagHelper).FullName}}
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute]
public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public string Bar { get; set; }
}
Expand Down Expand Up @@ -599,15 +598,15 @@ public void RazorPageWithNoLeadingPageDirective_Runtime()
public void RazorPage_WithCssScope()
{
// Arrange
AddCSharpSyntaxTree($$"""
[{{typeof(HtmlTargetElementAttribute).FullName}}("all")]
public class AllTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("all")]
public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public string Bar { get; set; }
}
[{{typeof(HtmlTargetElementAttribute).FullName}}("form")]
public class FormTagHelper : {{typeof(TagHelper).FullName}}
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("form")]
public class FormTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
""");
Expand Down Expand Up @@ -643,15 +642,15 @@ public class FormTagHelper : {{typeof(TagHelper).FullName}}
public void RazorView_WithCssScope()
{
// Arrange
AddCSharpSyntaxTree($$"""
[{{typeof(HtmlTargetElementAttribute).FullName}}("all")]
public class AllTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("all")]
public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public string Bar { get; set; }
}
[{{typeof(HtmlTargetElementAttribute).FullName}}("form")]
public class FormTagHelper : {{typeof(TagHelper).FullName}}
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("form")]
public class FormTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
""");
Expand Down Expand Up @@ -686,14 +685,14 @@ public class FormTagHelper : {{typeof(TagHelper).FullName}}
public void RazorView_Layout_WithCssScope()
{
// Arrange
AddCSharpSyntaxTree($$"""
[{{typeof(HtmlTargetElementAttribute).FullName}}("all")]
public class AllTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("all")]
public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public string Bar { get; set; }
}
[{{typeof(HtmlTargetElementAttribute).FullName}}("form")]
public class FormTagHelper : {{typeof(TagHelper).FullName}}
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute("form")]
public class FormTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
""");
Expand Down Expand Up @@ -1109,10 +1108,10 @@ public void BasicComponent_DesignTime()
public void Sections_DesignTime()
{
// Arrange
AddCSharpSyntaxTree($$"""
AddCSharpSyntaxTree("""
using Microsoft.AspNetCore.Mvc.ViewFeatures;
public class InputTestTagHelper : {{typeof(TagHelper).FullName}}
public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public ModelExpression For { get; set; }
}
Expand Down Expand Up @@ -1294,10 +1293,10 @@ public class ThisShouldBeGenerated
public void ModelExpressionTagHelper_DesignTime()
{
// Arrange
AddCSharpSyntaxTree($$"""
AddCSharpSyntaxTree("""
using Microsoft.AspNetCore.Mvc.ViewFeatures;
public class InputTestTagHelper : {{typeof(TagHelper).FullName}}
public class InputTestTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public ModelExpression For { get; set; }
}
Expand All @@ -1320,8 +1319,8 @@ public class InputTestTagHelper : {{typeof(TagHelper).FullName}}
public void RazorPages_DesignTime()
{
// Arrange
AddCSharpSyntaxTree($$"""
public class DivTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
Expand Down Expand Up @@ -1361,8 +1360,8 @@ public void RazorPagesWithRouteTemplate_DesignTime()
public void RazorPagesWithoutModel_DesignTime()
{
// Arrange
AddCSharpSyntaxTree($$"""
public class DivTagHelper : {{typeof(TagHelper).FullName}}
AddCSharpSyntaxTree("""
public class DivTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
}
Expand Down Expand Up @@ -1419,7 +1418,7 @@ public void ViewWithNamespace_DesignTime()
public void ViewComponentTagHelper_DesignTime()
{
// Arrange
AddCSharpSyntaxTree($$"""
AddCSharpSyntaxTree("""
public class TestViewComponent
{
public string Invoke(string firstName)
Expand All @@ -1428,8 +1427,8 @@ public string Invoke(string firstName)
}
}
[{{typeof(HtmlTargetElementAttribute).FullName}}]
public class AllTagHelper : {{typeof(TagHelper).FullName}}
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute]
public class AllTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{
public string Bar { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(DefaultNetCoreTargetFrameworks)</TargetFrameworks>
Expand All @@ -18,7 +18,6 @@
<ItemGroup>
<ProjectReference Include="..\..\Microsoft.CodeAnalysis.Razor.Compiler\src\Microsoft.CodeAnalysis.Razor.Compiler.csproj" />
<ProjectReference Include="..\..\..\Shared\Microsoft.AspNetCore.Razor.Test.Common\Microsoft.AspNetCore.Razor.Test.Common.csproj" />
<ProjectReference Include="..\..\test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.csproj" />

<PackageReference Include="Microsoft.CodeAnalysis.Common" VersionOverride="$(MicrosoftCodeAnalysisCommonPackageVersion)" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" VersionOverride="$(MicrosoftCodeAnalysisCSharpPackageVersion)" />
Expand All @@ -30,20 +29,4 @@
<ItemGroup>
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" Key="$(MoqPublicKey)" />
</ItemGroup>

<Target Name="CopyDepsFromShims_Build" AfterTargets="Build">
<ItemGroup>
<MvcShim Condition="$(TargetFramework) != ''" Include="$(ArtifactsBinDir)\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler\$(Configuration)\$(TargetFramework)\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.deps.json" />
</ItemGroup>

<Copy SourceFiles="@(MvcShim)" DestinationFolder="$(OutputPath)" />
</Target>

<Target Name="CopyDepsFromShims_Publish" AfterTargets="Publish">
<ItemGroup>
<MvcShim Condition="$(TargetFramework) != ''" Include="$(ArtifactsBinDir)\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler\$(Configuration)\$(TargetFramework)\Microsoft.AspNetCore.Razor.Test.MvcShim.Compiler.deps.json" />
</ItemGroup>

<Copy SourceFiles="@(MvcShim)" DestinationFolder="$(PublishDir)" Condition="Exists($(PublishDir))" />
</Target>
</Project>

This file was deleted.

Loading

0 comments on commit 4467256

Please sign in to comment.