Precept 0.14.0

Precept.Grpc

gRPC testing for Precept: pooled channels, typed clients, and assertions over status codes, deadlines and streaming responses.

dotnet add package Precept.Grpc
var greeter = Rpc.Client<Greeter.GreeterClient>();

var reply = await Rpc.CallAsync(
    () => greeter.SayHelloAsync(new HelloRequest { Name = "Ada" }, Rpc.Options()));

var greetings = await Rpc.CollectAsync(
    greeter.StreamGreetings(new HelloRequest { Name = "Ada" }, Rpc.Options()));

var status = await Rpc.ShouldFailAsync(
    () => greeter.SayHelloAsync(new HelloRequest(), Rpc.Options()),
    StatusCode.InvalidArgument);

Rpc.Client<T> works for any client generated from a .proto. Rpc.Options() carries the configured deadline and the test's cancellation token. Every call is logged with its duration and status. CollectAsync stops at maxItems (1000 by default), so a misbehaving stream cannot hang the test forever.

Channels are pooled per address for the run rather than opened per call. The address comes from configuration, so the same suite runs against a container started by Precept.Containers locally and against a deployed service in CI.

Note: the gRPC assertions are still the older helpers that throw on their own, rather than the Assert.That(…) sentence the rest of the framework uses. Moving them onto Subject<T> is planned.


Part of Precept, a .NET 10 test framework built on Microsoft.Testing.Platform. Full documentation: assertions · configuration · what is not built yet

Precept 0.14.0 · MIT · © 2026

Esc