Class RestResponseExpectations
The in-call shape expectation for a REST request: await the pending response and match it against
the expected shape in one expression, so the shape the test demands is stated where the call is
made. It is the same facade assertion response.Should.MatchShape(shape) performs, so there is
one shape implementation behind both spellings.
public static class RestResponseExpectations
- Inheritance
-
RestResponseExpectations
- Inherited Members
Methods
ExpectAsync<TShape>(Task<RestResponse>, TShape, JsonSerializerOptions?, bool)
Awaits the pending response and matches it against expectedShape through
MatchShape(object, JsonSerializerOptions?), returning the
response. On a mismatch the response is disposed and the
RestAssertionException is rethrown; exact also
demands that the response carries no field the shape does not mention.
public static Task<RestResponse> ExpectAsync<TShape>(this Task<RestResponse> responseTask, TShape expectedShape, JsonSerializerOptions? options = null, bool exact = false)
Parameters
responseTaskTask<RestResponse>expectedShapeTShapeoptionsJsonSerializerOptionsexactbool
Returns
Type Parameters
TShape