From da8752a31406aebafc9c6ef9e7c69d453384c721 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 25 Oct 2021 16:17:02 +1100 Subject: [PATCH] Update test framework for .NET 6 stuff --- .../Formatting/FormattingTestBase.cs | 4 +++- .../Language/IntegrationTests/RazorIntegrationTestBase.cs | 2 ++ .../Microsoft.AspNetCore.Components.netstandard2.0.cs | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingTestBase.cs index 8b541871e0..e2e4a71184 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting/FormattingTestBase.cs @@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Test; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Serialization; using Microsoft.CodeAnalysis.Razor.Workspaces.Extensions; @@ -255,11 +256,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting var projectEngine = RazorProjectEngine.Create(builder => { builder.SetRootNamespace("Test"); + builder.Features.Add(new DefaultTypeNameFeature()); RazorExtensions.Register(builder); }); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, new[] { importsDocument }, tagHelpers); - Assert.False(codeDocument.GetCSharpDocument().Diagnostics.Any(), "Error creating document: " + string.Join(Environment.NewLine, codeDocument.GetCSharpDocument().Diagnostics)); + Assert.False(codeDocument.GetCSharpDocument().Diagnostics.Any(), "Error creating document:" + Environment.NewLine + string.Join(Environment.NewLine, codeDocument.GetCSharpDocument().Diagnostics)); var documentSnapshot = new Mock(MockBehavior.Strict); documentSnapshot.Setup(d => d.GetGeneratedOutputAsync()).Returns(Task.FromResult(codeDocument)); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs index d074532029..930c449973 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs @@ -129,6 +129,8 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests b.Phases.Insert(0, new ForceLineEndingPhase(LineEnding)); } + b.Features.Add(new DefaultTypeNameFeature()); + b.Features.Add(new CompilationTagHelperFeature()); b.Features.Add(new DefaultMetadataReferenceFeature() { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs index 3cc898a9e0..6b69e18332 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -59,6 +59,12 @@ namespace Microsoft.AspNetCore.Components public string Suffix { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string ValueAttribute { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } } + [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = true, Inherited = false)] + public sealed class CascadingTypeParameterAttribute : System.Attribute + { + public CascadingTypeParameterAttribute(string name) { } + public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } + } [System.AttributeUsageAttribute(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)] public sealed partial class CascadingParameterAttribute : System.Attribute {