Class RestShouldAssertions
The positive assertions of a REST response, reached through Should. Shape is positive-only - a negated shape match has no meaning - so it lives here and not on the shared facade ShouldNot returns. MatchShape(object, JsonSerializerOptions?) returns the response, so assertions chain.
public sealed class RestShouldAssertions : RestAssertions
- Inheritance
-
RestShouldAssertions
- Inherited Members
- Extension Methods
Methods
MatchShape(object, bool, JsonSerializerOptions?)
Matches the response body against the expected shape exactly: a field present in the body that the shape does not mention is a mismatch naming the field, so the response cannot grow a field the test never asserted. A value constraint mentions its whole subtree. Returns the response.
public RestResponse MatchShape(object expectedShape, bool exact, JsonSerializerOptions? options = null)
Parameters
expectedShapeobjectexactbooloptionsJsonSerializerOptions
Returns
MatchShape(object, JsonSerializerOptions?)
Matches the response body against the expected shape and records the assertion on the test context. Every mismatch is reported at once, and the failure message starts with the request identifier. Returns the response.
public RestResponse MatchShape(object expectedShape, JsonSerializerOptions? options = null)
Parameters
expectedShapeobjectoptionsJsonSerializerOptions