Update test framework for .NET 6 stuff

This commit is contained in:
David Wengier 2021-10-25 16:17:02 +11:00
Родитель 4cf2007189
Коммит da8752a314
3 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -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<DocumentSnapshot>(MockBehavior.Strict);
documentSnapshot.Setup(d => d.GetGeneratedOutputAsync()).Returns(Task.FromResult(codeDocument));

Просмотреть файл

@ -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()
{

Просмотреть файл

@ -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
{