Rig.TUnit.HealthChecks
0.1.0-beta.2
dotnet add package Rig.TUnit.HealthChecks --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.HealthChecks -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.HealthChecks" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.HealthChecks" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.HealthChecks" />
paket add Rig.TUnit.HealthChecks --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.HealthChecks, 0.1.0-beta.2"
#:package Rig.TUnit.HealthChecks@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.HealthChecks&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.HealthChecks&version=0.1.0-beta.2&prerelease
Rig.TUnit.HealthChecks
HealthAssertfluent assertions for ASP.NET Core health endpoints +DependencyDownSimulatorfor dependency-flip testing.
What this package is
A small but opinionated health-check testing kit. HealthAssert.On( client, "/health/ready").Contains("database").IsHealthy().InTime(…)
encodes the full assertion shape in one line. DependencyDownSimulator
lets a test mark a named dependency unhealthy and verify the
live/ready/startup probe reports correctly — the standard way to
catch probe mis-wirings before they cascade in production.
When to use it
- Integration tests for services with
/health/live,/health/ready,/health/startupendpoints. - Verifying probe-response shape and timing.
- Asserting dependency-flip handling (DB down → ready unhealthy, live still up).
- Not for: unit-testing individual
IHealthCheckimplementations — use the ASP.NET CoreHealthCheckContextdirectly.
Prerequisites
- .NET 10 SDK
- Project under test registered health checks via
services.AddHealthChecks()with named checks.
Quick start
using Rig.TUnit.HealthChecks;
await HealthAssert.On(client, "/health/ready")
.Contains("database")
.IsHealthy()
.InTime(TimeSpan.FromSeconds(1));
Options
| Property | Type | Default | Description |
|---|---|---|---|
DefaultTimeout |
TimeSpan |
5s |
Per-probe call deadline |
ProbeKind |
ProbeKind |
Ready |
Live / Ready / Startup |
RequireJsonBody |
bool |
true |
Fail when response isn't JSON |
Fixture + helper APIs
Rig.TUnit.HealthChecks.HealthAssertRig.TUnit.HealthChecks.DependencyDownSimulatorRig.TUnit.HealthChecks.ProbeKind
Per-test isolation
Helpers are stateless. DependencyDownSimulator scopes its overrides
per-test via IAsyncDisposable — disposal restores normal health.
Safe under full parallelism.
Parallelism + performance
- Per-probe call: ~5–20 ms (HTTP round-trip).
- Safe under full parallelism.
Troubleshooting
HealthAssert.Contains("database")fails despite DB check registered — the check's name must match. Registrations likeAddDbContextCheck<TDbContext>("database")set the name; without it ASP.NET Core uses the class name.InTime(…)fails intermittently — the first probe call pays for JIT / connection-pool warm-up; run a warm-up call before the timed assertion.
See docs/troubleshooting.md#healthchecks.
Provider quirks + edge cases
- ASP.NET Core's
/healthendpoint returnsContent-Type: text/plainby default; setResponseWriter = UIResponseWriter.WriteHealthCheck UIResponse(fromAspNetCore.HealthChecks.UI.Client) for JSON, whichHealthAssertexpects. ProbeKind.Startupprobes exist in Kubernetes contracts but not all apps define them —HealthAssertreturns a documented no-op.
Benchmarks
See HealthChecksBenchmarks.cs;
baseline 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.Diagnostics.HealthChecks (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Rig.TUnit.Core (>= 0.1.0-beta.2)
- TUnit.Core (>= 1.34.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rig.TUnit.HealthChecks:
| Package | Downloads |
|---|---|
|
Rig.TUnit.All
Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.2 | 50 | 4/27/2026 |
| 0.0.0-alpha.0.14 | 58 | 4/26/2026 |