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, object, JsonSerializerOptions?)
Matches a message payload against an expected shape and records the assertion on the ambient
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.
[Obsolete("Use message.Should.MatchShape(shape) instead.")]
public static ProtoMessage ShouldMatchShape(this ProtoMessage message, object expectedShape, JsonSerializerOptions? options = null)
Parameters
messageProtoMessageexpectedShapeobjectoptionsJsonSerializerOptions
Returns
Remarks
Obsolete: use message.Should.MatchShape(shape).