Rig.TUnit.HealthChecks 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.HealthChecks.
dotnet add package Rig.TUnit.HealthChecks --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.HealthChecks -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.HealthChecks" 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.HealthChecks" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.HealthChecks" />
                    
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.HealthChecks --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.HealthChecks, 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.HealthChecks@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.HealthChecks&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.HealthChecks&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.HealthChecks

HealthAssert fluent assertions for ASP.NET Core health endpoints + DependencyDownSimulator for 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/startup endpoints.
  • Verifying probe-response shape and timing.
  • Asserting dependency-flip handling (DB down → ready unhealthy, live still up).
  • Not for: unit-testing individual IHealthCheck implementations — use the ASP.NET Core HealthCheckContext directly.

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.HealthAssert
  • Rig.TUnit.HealthChecks.DependencyDownSimulator
  • Rig.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 like AddDbContextCheck<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 /health endpoint returns Content-Type: text/plain by default; set ResponseWriter = UIResponseWriter.WriteHealthCheck UIResponse (from AspNetCore.HealthChecks.UI.Client) for JSON, which HealthAssert expects.
  • ProbeKind.Startup probes exist in Kubernetes contracts but not all apps define them — HealthAssert returns a documented no-op.

Benchmarks

See HealthChecksBenchmarks.cs; baseline 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 (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