Rig.TUnit.Core 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Core.
dotnet add package Rig.TUnit.Core --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Core -Version 0.1.0-beta.2
                    
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="Rig.TUnit.Core" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Core" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Core" />
                    
Project file
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 Rig.TUnit.Core --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Core, 0.1.0-beta.2"
                    
#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 Rig.TUnit.Core@0.1.0-beta.2
                    
#: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=Rig.TUnit.Core&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Core&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Core

The heart of Rig.TUnit — RigBuilder CRTP, IsolationKey, and the FixtureOptions base contract every provider builds on.

What this package is

The foundation layer. Every provider (Postgres, Redis, Kafka, Cosmos, …) derives from RigBuilder<TSelf> via the curiously-recurring template pattern so Use{Provider}(…) extension chains return strongly-typed builders without erasing state. IsolationKey.FromExecutionContext() reads the ambient TUnit test-context and produces a deterministic feature/class/method/iteration identifier that provider fixtures thread into container names, schema names, queue names — anywhere per-test naming matters.

If you are reading one README in this repo, read this one — everything else specialises what happens here.

When to use it

  • Authoring a new Rig.TUnit.* provider — derive your builder from RigBuilder<TSelf>.
  • Writing a domain-only test that needs IsolationKey but no container.
  • Consuming a fixture's Options class — every one of them has a public const string SectionName convention inherited from this package.
  • Not for: production application code. This is a test-only library.

Prerequisites

  • .NET 10 SDK. No runtime dependencies beyond Microsoft.Extensions.DependencyInjection.Abstractions and Microsoft.Extensions.Options.

Quick start

using Rig.TUnit.Core.Builder;
using Rig.TUnit.Core.Helpers;

var isolation = IsolationKey.FromExecutionContext();
var rig = new RigBuilder()
    .WithIsolation(isolation)
    .Build();

await using var _ = rig;

Options

Property Type Default Description
TimeProvider TimeProvider TimeProvider.System Injected clock; override in tests to freeze time.
DefaultCancellationTimeout TimeSpan 30s Auto-cancel token used by async helpers.

Fixture + helper APIs

  • Rig.TUnit.Core.Builder.RigBuilder / RigBuilder<TSelf> — CRTP root
  • Rig.TUnit.Core.Helpers.IsolationKey — per-test naming
  • Rig.TUnit.Core.Configuration.TestConfigurationBuilder — options binding
  • Rig.TUnit.Core.Fixtures.IRigFixture — the disposable fixture contract
  • Rig.TUnit.Core.Fakers.* — Bogus Faker<T> presets

Per-test isolation

IsolationKey.FromExecutionContext() returns a short, filesystem-safe identifier of the form fixture_ABCD1234 derived from the TUnit TestContext.TestDetails (class + method + iteration). Every provider fixture appends this to container / schema / queue names.

Parallelism + performance

  • Zero containers, zero I/O at Core level — new RigBuilder() is O(µs).
  • IsolationKey.FromExecutionContext() is a single SHA256 over the test-context tuple, memoised per AsyncLocal flow.
  • Safe under full test parallelism.

Troubleshooting

  • IsolationKey.FromExecutionContext() returns same value in two tests — confirm you are inside a TUnit test method, not a static constructor or module initialiser.
  • FixtureOptions.ValidateOnStart() fails — the bound configuration section is missing a [Required] property; the error message names it.

See docs/troubleshooting.md.

Provider quirks + edge cases

  • IsolationKey includes the test iteration index when you use TUnit's [Repeat] / [Arguments] attributes — critical when the same method runs N times against parallel fixtures.
  • RigBuilder uses CRTP, not interface-default-methods, because TUnit's source-generator-driven discovery historically struggled with interface-default method disambiguation (ADR-002).

Benchmarks

See CoreBenchmarks.cs and CoreBenchmarks.cs; baseline numbers are tracked in benchmarks/baseline-005.json.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET 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.

NuGet packages (23)

Showing the top 5 NuGet packages that depend on Rig.TUnit.Core:

Package Downloads
Rig.TUnit.Databases

Family base for database fixtures - shared abstractions consumed by both SQL and NoSQL leaf packages.

Rig.TUnit.Messaging

Messaging family base - EventSenderBase, ListenerBase, unified SendContext (SessionKey, PartitionKey, DeduplicationKey), and ITopologyBuilder consumed by every messaging leaf package.

Rig.TUnit.HealthChecks

TUnit fixture for ASP.NET Core health-check assertions - liveness/readiness lifecycle and degraded-state simulation.

Rig.TUnit.WebAPI

TUnit fixture for ASP.NET Core Web APIs - WebApplicationFactory-style host, OpenAPI drift assertions, and per-test client isolation.

Rig.TUnit.Observability

Observability family base - TelemetryFixtureBase, exemplar helpers, log-redaction utilities. Pull a leaf provider.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.2 121 4/27/2026
0.0.0-alpha.0.14 129 4/26/2026