Rig.TUnit.Core
0.1.0-beta.2
dotnet add package Rig.TUnit.Core --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.Core -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.Core" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Core" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.Core" />
paket add Rig.TUnit.Core --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Core, 0.1.0-beta.2"
#:package Rig.TUnit.Core@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Core&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.Core&version=0.1.0-beta.2&prerelease
Rig.TUnit.Core
The heart of Rig.TUnit —
RigBuilderCRTP,IsolationKey, and theFixtureOptionsbase 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 fromRigBuilder<TSelf>. - Writing a domain-only test that needs
IsolationKeybut no container. - Consuming a fixture's
Optionsclass — every one of them has apublic const string SectionNameconvention 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.AbstractionsandMicrosoft.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 rootRig.TUnit.Core.Helpers.IsolationKey— per-test namingRig.TUnit.Core.Configuration.TestConfigurationBuilder— options bindingRig.TUnit.Core.Fixtures.IRigFixture— the disposable fixture contractRig.TUnit.Core.Fakers.*— BogusFaker<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
Corelevel —new RigBuilder()is O(µs). IsolationKey.FromExecutionContext()is a singleSHA256over the test-context tuple, memoised perAsyncLocalflow.- 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.
Provider quirks + edge cases
IsolationKeyincludes the test iteration index when you use TUnit's[Repeat]/[Arguments]attributes — critical when the same method runs N times against parallel fixtures.RigBuilderuses 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.
Related docs
License
MIT. See LICENSE.
| Product | Versions 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. |
-
net10.0
- Bogus (>= 35.6.1)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- TUnit.Core (>= 1.34.5)
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 |