Class ProtoMessagingAssertions
Shape assertions for consumed messages, reusing the Json shape matcher the REST, GraphQL and gRPC integrations use. A message payload is Json by convention, so an expected anonymous shape reads the same way as elsewhere.
public static class ProtoMessagingAssertions
- Inheritance
-
ProtoMessagingAssertions
- Inherited Members
Methods
ShouldMatchShape(ProtoMessage, ProtoExecutionContext, object, JsonSerializerOptions?)
Matches a message payload against an expected shape and records the assertion on
context as an assert.json.shape operation with a
messaging.contract.shape observation. A mismatch fails the operation and rethrows the
shape exception; a payload that is empty or not Json fails with a message naming the destination.
public static ProtoMessage ShouldMatchShape(this ProtoMessage message, ProtoExecutionContext context, object expectedShape, JsonSerializerOptions? options = null)
Parameters
messageProtoMessagecontextProtoExecutionContextexpectedShapeobjectoptionsJsonSerializerOptions