Test projects become executables (OutputType=Exe) as required by v3. Satisfy the new xUnit1051 analyzer by passing TestContext cancellation tokens in the generator compilation test.
This commit is contained in:
@@ -109,13 +109,15 @@ public class AssetHandlesGeneratorTests
|
||||
|
||||
var compilation = CSharpCompilation.Create(
|
||||
"generated",
|
||||
[CSharpSyntaxTree.ParseText(source), CSharpSyntaxTree.ParseText(stubs)],
|
||||
[CSharpSyntaxTree.ParseText(source, cancellationToken: TestContext.Current.CancellationToken),
|
||||
CSharpSyntaxTree.ParseText(stubs, cancellationToken: TestContext.Current.CancellationToken)],
|
||||
[MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
|
||||
MetadataReference.CreateFromFile(System.Runtime.Loader.AssemblyLoadContext.Default
|
||||
.LoadFromAssemblyName(new System.Reflection.AssemblyName("System.Runtime")).Location)],
|
||||
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
|
||||
|
||||
var errors = compilation.GetDiagnostics().Where(d => d.Severity == DiagnosticSeverity.Error).ToList();
|
||||
var errors = compilation.GetDiagnostics(TestContext.Current.CancellationToken)
|
||||
.Where(d => d.Severity == DiagnosticSeverity.Error).ToList();
|
||||
Assert.Empty(errors);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user