Class RestAssertions

Namespace
ProtoTest.Rest
Assembly
ProtoTest.Rest.dll

The status assertions reachable through Should and ShouldNot; the shared facade owns the polarity.

public class RestAssertions : ProtoHttpAssertions<RestResponse>
Inheritance
RestAssertions
Derived
Inherited Members
Extension Methods

Methods

AssertStatus(HttpStatusCode, bool)

Runs the protocol's status assertion with the facade's polarity.

protected override RestResponse AssertStatus(HttpStatusCode expected, bool negated)

Parameters

expected HttpStatusCode
negated bool

Returns

RestResponse

HaveContentType(string)

Asserts the response body's content type, comparing its media type without parameters (case-insensitively); on ShouldNot it asserts the response carries anything but that media type. Returns the response.

public RestResponse HaveContentType(string mediaType)

Parameters

mediaType string

Returns

RestResponse

HaveCookie(string)

Asserts the response sets a cookie with name (case-sensitive, as cookie names are); on ShouldNot it asserts the cookie is not set. Returns the response.

public RestResponse HaveCookie(string name)

Parameters

name string

Returns

RestResponse

HaveCookie(string, string)

Asserts the response sets a cookie with name and a value equal to value (ordinal); on ShouldNot it asserts no such value is set. Returns the response.

public RestResponse HaveCookie(string name, string value)

Parameters

name string
value string

Returns

RestResponse

HaveHeader(string)

Asserts the response carries a header with name; on ShouldNot it asserts the header is absent. Returns the response.

public RestResponse HaveHeader(string name)

Parameters

name string

Returns

RestResponse

HaveHeader(string, string)

Asserts the response carries a header with name and a value equal to value (ordinal; any value of a multi-valued header matches); on ShouldNot it asserts no such value is present. Returns the response.

public RestResponse HaveHeader(string name, string value)

Parameters

name string
value string

Returns

RestResponse

HaveRedirectLocation(string)

Asserts the response's Location header equals location as it arrived (ordinal, relative or absolute); on ShouldNot it asserts the header carries anything but that location. Returns the response.

public RestResponse HaveRedirectLocation(string location)

Parameters

location string

Returns

RestResponse