Class Extensions
- Namespace
- Albatross.CodeAnalysis.Testing
- Assembly
- Albatross.CodeAnalysis.Testing.dll
Provides extension methods for creating Roslyn compilations in test scenarios.
public static class Extensions
- Inheritance
-
Extensions
- Inherited Members
Methods
CreateNet8CompilationAsync(string, string, CancellationToken)
Creates a C# compilation targeting .NET 8 with C# 12 language version from the provided source code.
public static Task<CSharpCompilation> CreateNet8CompilationAsync(this string source, string assemblyName = "Net8TestAssembly", CancellationToken cancellationToken = default)
Parameters
sourcestringThe C# source code to compile.
assemblyNamestringThe name of the assembly. Defaults to "Net8TestAssembly".
cancellationTokenCancellationTokenA cancellation token to observe while waiting for the task to complete.
Returns
- Task<CSharpCompilation>
A CSharpCompilation configured for .NET 8 with the parsed source code.