Purview.SourceGeneratorFramework.Testing.TUnit
1.0.0-prerelease.17
This is a prerelease version of Purview.SourceGeneratorFramework.Testing.TUnit.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Purview.SourceGeneratorFramework.Testing.TUnit --version 1.0.0-prerelease.17
NuGet\Install-Package Purview.SourceGeneratorFramework.Testing.TUnit -Version 1.0.0-prerelease.17
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Purview.SourceGeneratorFramework.Testing.TUnit" Version="1.0.0-prerelease.17" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Purview.SourceGeneratorFramework.Testing.TUnit" Version="1.0.0-prerelease.17" />
<PackageReference Include="Purview.SourceGeneratorFramework.Testing.TUnit" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Purview.SourceGeneratorFramework.Testing.TUnit --version 1.0.0-prerelease.17
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Purview.SourceGeneratorFramework.Testing.TUnit, 1.0.0-prerelease.17"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Purview.SourceGeneratorFramework.Testing.TUnit@1.0.0-prerelease.17
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Purview.SourceGeneratorFramework.Testing.TUnit&version=1.0.0-prerelease.17&prerelease
#tool nuget:?package=Purview.SourceGeneratorFramework.Testing.TUnit&version=1.0.0-prerelease.17&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Purview.SourceGeneratorFramework.Testing.TUnit
TUnit integration for testing incremental C# source generators built with Purview.SourceGeneratorFramework.
Installation
dotnet add package Purview.SourceGeneratorFramework.Testing.TUnit
What's included
TUnitSourceGeneratorTestBase<TGenerator>— ready-made base class for TUnit tests. It wires generator log output toTestContext.Current.OutputWriter.- Custom TUnit assertions for inspecting
DriverRunResultinstances directly in TUnit tests. - MSBuild
.props— automatically addsglobal usingdirectives forPurview.SourceGeneratorFramework.Testing.TUnitandPurview.SourceGeneratorFramework.Testing.TUnit.Assertions.
Usage
Reference the package from a TUnit test project:
<ItemGroup>
<PackageReference Include="TUnit" />
<PackageReference Include="Purview.SourceGeneratorFramework.Testing.TUnit" />
</ItemGroup>
Derive your test class from TUnitSourceGeneratorTestBase<TGenerator> and use the inherited GenerateAsync method:
using Purview.SourceGeneratorFramework.Testing.TUnit;
public class MyGeneratorTests : TUnitSourceGeneratorTestBase<MyGenerator>
{
[Test]
public async Task GeneratesExpectedSource()
{
var source = """
[MyNamespace.MyAttribute]
public partial class MyClass { }
""";
var result = await GenerateAsync(source);
result.AssertNoCompilationErrors();
var generated = result.AssertSingleGeneratedSource();
await Assert.That(generated).Contains("public static partial class MyClass");
}
}
The base class also provides access to the underlying SourceGeneratorTestRunner<TGenerator> behavior through GenerateAsync.
License
This project is licensed under the MIT license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.CodeAnalysis.Analyzers (>= 5.6.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.13.0)
- Purview.SourceGeneratorFramework.Testing (>= 1.0.0-prerelease.17)
- TUnit.Assertions (>= 1.61.0)
- TUnit.Core (>= 1.61.0)
-
net8.0
- Microsoft.CodeAnalysis.Analyzers (>= 5.6.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.13.0)
- Purview.SourceGeneratorFramework.Testing (>= 1.0.0-prerelease.17)
- System.Collections.Immutable (>= 9.0.0)
- TUnit.Assertions (>= 1.61.0)
- TUnit.Core (>= 1.61.0)
-
net9.0
- Microsoft.CodeAnalysis.Analyzers (>= 5.6.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.13.0)
- Purview.SourceGeneratorFramework.Testing (>= 1.0.0-prerelease.17)
- TUnit.Assertions (>= 1.61.0)
- TUnit.Core (>= 1.61.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-prerelease.25 | 35 | 8/27/2026 |
| 1.0.0-prerelease.24 | 57 | 8/19/2026 |
| 1.0.0-prerelease.23 | 55 | 8/19/2026 |
| 1.0.0-prerelease.22 | 57 | 8/19/2026 |
| 1.0.0-prerelease.21 | 64 | 8/18/2026 |
| 1.0.0-prerelease.20 | 56 | 8/18/2026 |
| 1.0.0-prerelease.19 | 68 | 8/17/2026 |
| 1.0.0-prerelease.18 | 64 | 8/16/2026 |
| 1.0.0-prerelease.17 | 58 | 8/14/2026 |
| 1.0.0-prerelease.16 | 59 | 8/13/2026 |
| 1.0.0-prerelease.15 | 48 | 8/13/2026 |
| 1.0.0-prerelease.14 | 52 | 8/13/2026 |
| 1.0.0-prerelease.13 | 60 | 8/13/2026 |
| 1.0.0-prerelease.12 | 62 | 8/12/2026 |
| 1.0.0-prerelease.11 | 52 | 8/12/2026 |
| 1.0.0-prerelease.10 | 56 | 8/12/2026 |
| 1.0.0-prerelease.9 | 74 | 8/11/2026 |
| 1.0.0-prerelease.7 | 62 | 8/9/2026 |
| 1.0.0-prerelease.6 | 55 | 8/8/2026 |
| 1.0.0-prerelease.5 | 58 | 8/7/2026 |
Loading failed