Table of Contents

Class GrpcServerStreamAssertionExtensions

Namespace
TUnit.Assertions.Extensions
Assembly
GrpcAssertions.TUnit.dll

TUnit entry point for asserting on the responses of a gRPC server-streaming call. Extends the value assertion source produced by Assert.That(call) where call is an AsyncServerStreamingCall<TResponse>, returning a chain that reads the response stream once and validates the accumulated expectations. The method lives in TUnit.Assertions.Extensions so it is auto-imported alongside TUnit's own assertions.

public static class GrpcServerStreamAssertionExtensions
Inheritance
GrpcServerStreamAssertionExtensions
Inherited Members

Methods

Streams<TResponse>(IAssertionSource<AsyncServerStreamingCall<TResponse>>, CancellationToken)

Begins a server-streaming assertion over the call's responses. Chain StreamsAtLeast, StreamsExactly, StreamContains, and AndStreamItems to narrow the assertion; the response stream is read once, when the assertion is awaited.

public static ServerStreamAssertion<TResponse> Streams<TResponse>(this IAssertionSource<AsyncServerStreamingCall<TResponse>> source, CancellationToken cancellationToken = default)

Parameters

source IAssertionSource<AsyncServerStreamingCall<TResponse>>

The value assertion source carrying the server-streaming call.

cancellationToken CancellationToken

The token threaded into the response-stream read.

Returns

ServerStreamAssertion<TResponse>

A ServerStreamAssertion<TResponse> for further chaining.

Type Parameters

TResponse

The streamed response message type.

Exceptions

ArgumentNullException

source is null.