Interface IHttpResponseTestBuilder
Used for testing Microsoft.AspNetCore.Http.HttpResponse.
Namespace:MyTested.AspNetCore.Mvc.Builders.Contracts.Http
Assembly:MyTested.AspNetCore.Mvc.Http.dll
Syntax
public interface IHttpResponseTestBuilder
Methods
| Improve this Doc View SourceContainingCookie(Action<IResponseCookieTestBuilder>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Cookies contains cookie by using test builder.
Declaration
IAndHttpResponseTestBuilder ContainingCookie(Action<IResponseCookieTestBuilder> cookieBuilder)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IResponseCookieTestBuilder> | cookieBuilder | Action of response cookie test builder. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingCookie(String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Cookies contains cookie with the same name as the provided one.
Declaration
IAndHttpResponseTestBuilder ContainingCookie(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected cookie name. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingCookie(String, String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Cookies contains cookie with the same name and value as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingCookie(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected cookie name. |
System.String | value | Expected cookie value. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingCookie(String, String, CookieOptions)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Cookies contains cookie with the same name, value and options as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingCookie(string name, string value, CookieOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected cookie name. |
System.String | value | Expected cookie value. |
Microsoft.AspNetCore.Http.CookieOptions | options | Expected cookie options. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingCookies(IDictionary<String, String>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Cookies contains the provided dictionary of cookies.
Declaration
IAndHttpResponseTestBuilder ContainingCookies(IDictionary<string, string> cookies)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | cookies | Dictionary of cookies. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingCookies(Object)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Cookies contains the provided dictionary of cookies.
Declaration
IAndHttpResponseTestBuilder ContainingCookies(object cookies)
Parameters
Type | Name | Description |
---|---|---|
System.Object | cookies | Anonymous object of cookies. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeader(String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains header with the same name as the provided one.
Declaration
IAndHttpResponseTestBuilder ContainingHeader(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected header name. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeader(String, StringValues)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains header with the same name and values as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeader(string name, StringValues values)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected header name. |
Microsoft.Extensions.Primitives.StringValues | values | Expected header values. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeader(String, IEnumerable<String>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains header with the same name and values as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeader(string name, IEnumerable<string> values)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected header name. |
System.Collections.Generic.IEnumerable<System.String> | values | Expected header values. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeader(String, String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains header with the same name and value as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeader(string name, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected header name. |
System.String | value | Expected header value. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeader(String, String[])
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains header with the same name and values as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeader(string name, params string[] values)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Expected header name. |
System.String[] | values | Expected header values. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeaders(IHeaderDictionary)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains the same headers as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeaders(IHeaderDictionary headers)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.IHeaderDictionary | headers | Dictionary of headers. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeaders(IDictionary<String, StringValues>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains the same headers as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeaders(IDictionary<string, StringValues> headers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, Microsoft.Extensions.Primitives.StringValues> | headers | Dictionary of headers. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeaders(IDictionary<String, IEnumerable<String>>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains the same headers as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeaders(IDictionary<string, IEnumerable<string>> headers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Collections.Generic.IEnumerable<System.String>> | headers | Dictionary of headers. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeaders(IDictionary<String, String>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains the same headers as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeaders(IDictionary<string, string> headers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | headers | Dictionary of headers. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
ContainingHeaders(Object)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Headers contains the same headers as the provided ones.
Declaration
IAndHttpResponseTestBuilder ContainingHeaders(object headers)
Parameters
Type | Name | Description |
---|---|---|
System.Object | headers | Anonymous object of headers. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithBody(Stream)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body has the same contents as the provided Stream.
Declaration
IAndHttpResponseTestBuilder WithBody(Stream body)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | body | Expected stream body. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithBody<TBody>(TBody, String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body has deeply equal value as the provided one. Body is parsed from the configured formatters and provided content type. Uses System.Text.Encoding.UTF8 encoding.
Declaration
IAndHttpResponseTestBuilder WithBody<TBody>(TBody body, string contentType)
Parameters
Type | Name | Description |
---|---|---|
TBody | body | Expected body object. |
System.String | contentType | Expected content type as string. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
Type Parameters
Name | Description |
---|---|
TBody | Expected type of body to test. |
WithBody<TBody>(TBody, String, Encoding)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body has deeply equal value as the provided one. Body is parsed from the configured formatters and provided content type.
Declaration
IAndHttpResponseTestBuilder WithBody<TBody>(TBody body, string contentType, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
TBody | body | Expected body object. |
System.String | contentType | Expected content type as string. |
System.Text.Encoding | encoding | Encoding of the body. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
Type Parameters
Name | Description |
---|---|
TBody | Expected type of body to test. |
WithBodyOfType<TBody>(String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body has the same type as the provided one. Body is parsed from the configured formatters and provided content type. Uses System.Text.Encoding.UTF8 encoding.
Declaration
IAndHttpResponseTestBuilder WithBodyOfType<TBody>(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | Expected content type as string. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
Type Parameters
Name | Description |
---|---|
TBody | Expected type of body to test. |
WithBodyOfType<TBody>(String, Encoding)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body has the same type as the provided one. Body is parsed from the configured formatters and provided content type.
Declaration
IAndHttpResponseTestBuilder WithBodyOfType<TBody>(string contentType, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | Expected content type as string. |
System.Text.Encoding | encoding | Encoding of the body. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
Type Parameters
Name | Description |
---|---|
TBody | Expected type of body to test. |
WithContentLength(Nullable<Int64>)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.ContentLength is the same as the provided one.
Declaration
IAndHttpResponseTestBuilder WithContentLength(long ? contentLenght)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int64> | contentLenght | Expected content length. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithContentType(String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.ContentType is the same as the provided one.
Declaration
IAndHttpResponseTestBuilder WithContentType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | Expected content type. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithJsonBody(String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body is equal to the provided JSON string. Body is parsed from the configured formatters and 'application/json' content type. Uses System.Text.Encoding.UTF8 encoding.
Declaration
IAndHttpResponseTestBuilder WithJsonBody(string jsonBody)
Parameters
Type | Name | Description |
---|---|---|
System.String | jsonBody | Expected body as JSON string. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithJsonBody(String, Encoding)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body is equal to the provided JSON string. Body is parsed from the configured formatters and 'application/json' content type.
Declaration
IAndHttpResponseTestBuilder WithJsonBody(string jsonBody, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | jsonBody | Expected body as JSON string. |
System.Text.Encoding | encoding | Encoding of the body. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithJsonBody<TBody>(TBody)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body is deeply equal to the provided object. Body is parsed from the configured formatters and 'application/json' content type. Uses System.Text.Encoding.UTF8 encoding.
Declaration
IAndHttpResponseTestBuilder WithJsonBody<TBody>(TBody jsonBody)
Parameters
Type | Name | Description |
---|---|---|
TBody | jsonBody | Expected body as object. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
Type Parameters
Name | Description |
---|---|
TBody | Expected type of body to test. |
WithJsonBody<TBody>(TBody, Encoding)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body is equal to the provided JSON string. Body is parsed from the configured formatters and 'application/json' content type.
Declaration
IAndHttpResponseTestBuilder WithJsonBody<TBody>(TBody jsonBody, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
TBody | jsonBody | Expected body as object. |
System.Text.Encoding | encoding | Encoding of the body. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
Type Parameters
Name | Description |
---|---|
TBody | Expected type of body to test. |
WithStatusCode(Int32)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.StatusCode status code is the same as the provided one.
Declaration
IAndHttpResponseTestBuilder WithStatusCode(int statusCode)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | Expected status code as integer. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithStatusCode(HttpStatusCode)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.StatusCode status code is the same as the provided HttpStatusCode.
Declaration
IAndHttpResponseTestBuilder WithStatusCode(HttpStatusCode statusCode)
Parameters
Type | Name | Description |
---|---|---|
System.Net.HttpStatusCode | statusCode | Expected status code as HttpStatusCode. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithStringBody(String)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body is equal to the provided string. Body is parsed from the configured formatters and 'text/plain' content type. Uses System.Text.Encoding.UTF8 encoding.
Declaration
IAndHttpResponseTestBuilder WithStringBody(string body)
Parameters
Type | Name | Description |
---|---|---|
System.String | body | Expected body as string. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |
WithStringBody(String, Encoding)
Tests whether Microsoft.AspNetCore.Http.HttpResponse.Body is equal to the provided string. Body is parsed from the configured formatters and 'text/plain' content type.
Declaration
IAndHttpResponseTestBuilder WithStringBody(string body, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | body | Expected body as string. |
System.Text.Encoding | encoding | Encoding of the body. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.Http.IAndHttpResponseTestBuilder test builder. |