Class RestResponseExpectations

Namespace
ProtoTest.Rest
Assembly
ProtoTest.Rest.dll

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

responseTask Task<RestResponse>
expectedShape TShape
options JsonSerializerOptions
exact bool

Returns

Task<RestResponse>

Type Parameters

TShape