Class ProtoGrpcMessageAssertions<TResponse>

Namespace
ProtoTest.Grpc
Assembly
ProtoTest.Grpc.dll

The shape-assertion facade of one gRPC reply message, reached through For<TResponse>(TResponse). Shape has no negated form, so the facade is positive-only. MatchShape(object, JsonSerializerOptions?) returns the message, so assertions chain.

public sealed class ProtoGrpcMessageAssertions<TResponse> where TResponse : IMessage

Type Parameters

TResponse
Inheritance
ProtoGrpcMessageAssertions<TResponse>
Inherited Members
Extension Methods

Properties

Should

The positive assertions of the reply, for example Should.MatchShape(shape).

public ProtoGrpcMessageAssertions<TResponse> Should { get; }

Property Value

ProtoGrpcMessageAssertions<TResponse>

Methods

MatchShape(object, bool, JsonSerializerOptions?)

Matches the reply against an expected shape exactly through the shared matcher, so a field the shape does not mention is a mismatch naming the field; a value constraint mentions its whole subtree. Returns the message.

public TResponse MatchShape(object expectedShape, bool exact, JsonSerializerOptions? options = null)

Parameters

expectedShape object
exact bool
options JsonSerializerOptions

Returns

TResponse

MatchShape(object, JsonSerializerOptions?)

Matches the reply against an expected shape through the shared matcher and records the assertion on the ambient Context. A mismatch is rethrown as a GrpcAssertionException whose message starts with the message type, with the matcher exception - and its mismatch list - as the inner exception. Returns the message.

public TResponse MatchShape(object expectedShape, JsonSerializerOptions? options = null)

Parameters

expectedShape object
options JsonSerializerOptions

Returns

TResponse