Rig.TUnit.Grpc
0.1.0-beta.2
dotnet add package Rig.TUnit.Grpc --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.Grpc -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.Grpc" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Grpc" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.Grpc" />
paket add Rig.TUnit.Grpc --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Grpc, 0.1.0-beta.2"
#:package Rig.TUnit.Grpc@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Grpc&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.Grpc&version=0.1.0-beta.2&prerelease
Rig.TUnit.Grpc
In-process gRPC test host, client factory, and error-metadata helpers for
Grpc.AspNetCoreservices.
What this package is
A WebApplicationFactory-style host that spins up your gRPC service in the
same process as the test, so calls skip the network stack entirely while
still exercising the full MVC pipeline (authentication, interceptors,
problem-details translation). The GrpcTestHost owns the TestServer,
wires a gRPC channel over the HttpMessageHandler, and exposes strongly-typed
clients for every service you register.
The helpers also include an RpcException inspector that unpacks the
binary problem-details-bin metadata key Microsoft's error-handling
middleware emits, so assertions can target ProblemDetails.Status,
Detail, and Type directly.
When to use it
- Testing a gRPC-first service (command side, query side, gateway).
- Verifying authentication policies behave correctly over gRPC.
- Asserting on structured error responses (
RpcException+ problem-details). - Not for: testing the external HTTP/2 surface — use an integration test with a real port for that.
Prerequisites
- .NET 10 SDK
- Project under test references
Grpc.AspNetCore.
Quick start
using Rig.TUnit.Grpc.Builder;
using Rig.TUnit.Core.Builder;
using Rig.TUnit.Core.Helpers;
var rig = new RigBuilder()
.WithIsolation(IsolationKey.FromExecutionContext())
.UseGrpc(cfg => cfg.ConfigureServices(s => s.AddLogging()))
.Build();
await using var _ = rig;
Options
| Property | Type | Default | Description |
|---|---|---|---|
EnableDetailedErrors |
bool |
true |
Include stack traces in RpcException.Status.Detail. |
MaxReceiveMessageSize |
int? |
null |
Channel-side limit; null = gRPC default 4 MB. |
ClientTimeout |
TimeSpan |
30s |
Default deadline applied to generated clients. |
Fixture + helper APIs
Rig.TUnit.Grpc.Builder.GrpcRigBuilder— CRTP builderRig.TUnit.Grpc.Helpers.GrpcTestHost— in-process host + channelRig.TUnit.Grpc.Helpers.ProblemDetailsAssert— unpackproblem-details-bin
Per-test isolation
Every GrpcTestHost runs in its own TestServer; the channel's base URI
includes the IsolationKey so traces and logs segregate cleanly. Services
registered with DI are fresh per test.
Parallelism + performance
- Host startup: ~40 ms (cached assembly scan amortises after first test).
- Per-call overhead: ~200 µs (in-memory pipe — no TCP round-trip).
- Safe under full test parallelism — each test owns its
TestServer.
Troubleshooting
Grpc.Core.RpcException: Status(StatusCode="Internal")— inspectex.Trailersforproblem-details-bin;ProblemDetailsAssert.From(ex)does this for you.- Host startup slow — first test in a session pays for gRPC reflection assembly scan; subsequent tests reuse the cached result.
Provider quirks + edge cases
RpcException.Trailersis empty until the call completes — probe it inside thecatchbranch, not during streaming.- gRPC's exception translation interceptor (
ApplicationExceptionInterceptor) serialisesIProblemDetailsProvider-typed exceptions into binary metadata — non-typed exceptions become genericInternalstatus codes.
Benchmarks
See GrpcBenchmarks.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)
- Google.Protobuf (>= 3.32.1)
- Grpc.AspNetCore (>= 2.67.0)
- Grpc.AspNetCore.Server (>= 2.67.0)
- Grpc.Net.Client (>= 2.67.0)
- Grpc.Tools (>= 2.67.0)
- Mediator.Abstractions (>= 3.0.2)
- Microsoft.AspNetCore.Mvc.Testing (>= 10.0.0)
- Rig.TUnit.Core (>= 0.1.0-beta.2)
- Rig.TUnit.Mediator (>= 0.1.0-beta.2)
- Serilog (>= 4.2.0)
- Serilog.Sinks.Console (>= 6.0.0)
- TUnit.Core (>= 1.34.5)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Rig.TUnit.Grpc:
| 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). |
|
|
Rig.TUnit
Convenience meta-package bundling Core + Mediator + Grpc + WebAPI — the default entry point for most projects. Use Rig.TUnit.All only when you need every package. |
|
|
Rig.TUnit.Microservices
Meta-package: Core + Mediator + Grpc + Outbox + Tracing + Jwt + Seq — the opinionated microservice testing kit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.2 | 44 | 4/27/2026 |
| 0.0.0-alpha.0.14 | 55 | 4/26/2026 |