Rig.TUnit.Grpc 0.1.0-beta.2

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

Rig.TUnit.Grpc

In-process gRPC test host, client factory, and error-metadata helpers for Grpc.AspNetCore services.

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 builder
  • Rig.TUnit.Grpc.Helpers.GrpcTestHost — in-process host + channel
  • Rig.TUnit.Grpc.Helpers.ProblemDetailsAssert — unpack problem-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") — inspect ex.Trailers for problem-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.

See docs/troubleshooting.md.

Provider quirks + edge cases

  • RpcException.Trailers is empty until the call completes — probe it inside the catch branch, not during streaming.
  • gRPC's exception translation interceptor (ApplicationExceptionInterceptor) serialises IProblemDetailsProvider-typed exceptions into binary metadata — non-typed exceptions become generic Internal status codes.

Benchmarks

See GrpcBenchmarks.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 (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