MY TESTED ASP.NET CORE MVC DOCS
  • Tutorial
  • Testing Guide
  • API Reference
  • Troubleshoot
  • About
  • API Reference
  • MyTested.AspNetCore.Mvc.Builders.Contracts.Http
  • IHttpResponseTestBuilder
Show / Hide Table of Contents
  • Common Classes & Extensions
    • ActionAttributesTestBuilderViewFeaturesExtensions
    • AuthenticationScheme
    • BadRequestTestBuilderDataAnnotationsExtensions
    • BadRequestTestBuilderExtensions
    • BaseShouldReturnTestBuilderExtensions
    • BaseTestBuilderWithResponseModelExtensions
    • ComponentBuilderAuthenticationExtensions
    • ComponentBuilderCachingExtensions
    • ComponentBuilderDependencyInjectionExtensions
    • ComponentBuilderEntityFrameworkCoreExtensions
    • ComponentBuilderHttpExtensions
    • ComponentBuilderOptionsExtensions
    • ComponentBuilderRoutingExtensions
    • ComponentBuilderSessionExtensions
    • ComponentBuilderTempDataExtensions
    • ComponentShouldHaveTestBuilderCachingExtensions
    • ComponentShouldHaveTestBuilderEntityFrameworkCoreExtensions
    • ComponentShouldHaveTestBuilderHttpExtensions
    • ComponentShouldHaveTestBuilderModelStateExtensions
    • ComponentShouldHaveTestBuilderSessionExtensions
    • ComponentShouldHaveTestBuilderTempDataExtensions
    • ComponentShouldHaveTestBuilderViewBagExtensions
    • ComponentShouldHaveTestBuilderViewDataExtensions
    • ContentType
    • ControllerBuilderDataAnnotationsExtensions
    • CreatedTestBuilderExtensions
    • From
    • HttpHeader
    • HttpMethod
    • HttpRequestBuilderAuthenticationExtensions
    • HttpRequestBuilderViewFeaturesExtensions
    • HttpScheme
    • HttpStatusCode
    • LocalRedirectTestBuilderExtensions
    • ModelErrorDetailsTestBuilderViewFeaturesExtensions
    • ModelErrorTestBuilderViewFeaturesExtensions
    • MyApplication
    • MyController<TController>
    • MyMvc
    • MyRouting
    • MyViewComponent<TViewComponent>
    • RedirectTestBuilderExtensions
    • ResolvedRouteTestBuilderDataAnnotationsExtensions
    • ServiceCollectionAbstractionsExtensions
    • ServiceCollectionCachingExtensions
    • ServiceCollectionControllersExtensions
    • ServiceCollectionCoreExtensions
    • ServiceCollectionEntityFrameworkCoreExtensions
    • ServiceCollectionExtensions
    • ServiceCollectionHttpExtensions
    • ServiceCollectionOptionsExtensions
    • ServiceCollectionRoutingExtensions
    • ServiceCollectionSessionExtensions
    • ServiceCollectionTempDataExtensions
    • ServiceCollectionUniverseExtensions
    • ServiceCollectionViewComponentsExtensions
    • ServiceCollectionViewFeaturesExtensions
    • ShouldReturnTestBuilderExtensions
    • ShouldReturnTestBuilderJsonResultExtensions
    • ShouldReturnTestBuilderPartialViewResultExtensions
    • ShouldReturnTestBuilderViewComponentResultExtensions
    • ShouldReturnTestBuilderViewResultExtensions
    • ViewComponentShouldReturnTestBuilderExtensions
    • With
  • ActionResults.BadRequest
    • IBadRequestErrorMessageTestBuilder
    • IBadRequestTestBuilder
  • ActionResults.Challenge
    • IChallengeTestBuilder
  • ActionResults.Content
    • IContentTestBuilder
  • ActionResults.Created
    • ICreatedTestBuilder
  • ActionResults.File
    • IFileTestBuilder
    • IPhysicalFileTestBuilder
  • ActionResults.Forbid
    • IForbidTestBuilder
  • ActionResults.Json
    • IJsonSerializerSettingsTestBuilder
    • IJsonTestBuilder
  • ActionResults.LocalRedirect
    • ILocalRedirectTestBuilder
  • ActionResults.NotFound
    • INotFoundTestBuilder
  • ActionResults.Object
    • IObjectTestBuilder
  • ActionResults.Ok
    • IOkTestBuilder
  • ActionResults.Redirect
    • IRedirectTestBuilder
  • ActionResults.StatusCode
    • IStatusCodeTestBuilder
  • ActionResults.View
    • IViewComponentTestBuilder
    • IViewTestBuilder
  • Actions
    • IActionResultTestBuilder<TActionResult>
    • IShouldHaveTestBuilder<TActionResult>
    • IShouldReturnTestBuilder<TActionResult>
    • IVoidActionResultTestBuilder
  • Application
    • IApplicationConfigurationBuilder
  • Attributes
    • IActionAttributesTestBuilder
    • IBaseAttributesTestBuilder<TAttributesTestBuilder>
    • IControllerActionAttributesTestBuilder<TAttributesTestBuilder>
    • IControllerAttributesTestBuilder
    • IViewComponentAttributesTestBuilder
  • Authentication
    • IAuthenticationPropertiesTestBuilder
    • IClaimsIdentityBuilder
    • IClaimsPrincipalBuilder
  • Base
    • IBaseTestBuilder
    • IBaseTestBuilderWithAction
    • IBaseTestBuilderWithActionResult<TActionResult>
    • IBaseTestBuilderWithComponent
    • IBaseTestBuilderWithComponentBuilder<TBuilder>
    • IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder>
    • IBaseTestBuilderWithController
    • IBaseTestBuilderWithInvokedAction
    • IBaseTestBuilderWithModel<TModel>
    • IBaseTestBuilderWithModelError
    • IBaseTestBuilderWithResponseModel
    • IBaseTestBuilderWithViewComponent
    • IBaseTestBuilderWithViewComponentInvocation
    • IBaseTestBuilderWithViewComponentResult<TInvocationResult>
  • CaughtExceptions
    • IAggregateExceptionTestBuilder
    • IBaseExceptionTestBuilder
    • IExceptionMessageTestBuilder
    • IExceptionTestBuilder
    • IShouldThrowTestBuilder
  • Controllers
    • IControllerBuilder<TController>
    • IControllerTestBuilder
  • Data
    • IDataProviderEntryDetailsTestBuilder<TValue>
    • IDataProviderEntryKeyTestBuilder
    • IDataProviderEntryTestBuilder
    • IDbContextBuilder
    • IDbContextTestBuilder
    • IMemoryCacheBuilder
    • IMemoryCacheEntryBuilder
    • IMemoryCacheEntryDetailsTestBuilder<TValue>
    • IMemoryCacheEntryKeyBuilder
    • IMemoryCacheEntryKeyTestBuilder
    • IMemoryCacheEntryTestBuilder
    • IMemoryCacheTestBuilder
    • ISessionBuilder
    • ISessionTestBuilder
    • ITempDataBuilder
    • ITempDataTestBuilder
    • IViewBagTestBuilder
    • IViewDataTestBuilder
  • Http
    • IHttpRequestBuilder
    • IHttpResponseTestBuilder
    • IResponseCookieTestBuilder
  • Invocations
    • IBaseShouldReturnTestBuilder
    • IBaseShouldReturnTestBuilder<TInvocationResult, TBuilder>
    • IBaseShouldReturnTestBuilder<TInvocationResult>
    • IViewComponentResultTestBuilder<TInvocationResult>
    • IViewComponentShouldHaveTestBuilder<TInvocationResult>
    • IViewComponentShouldReturnTestBuilder<TInvocationResult>
  • Models
    • IModelDetailsTestBuilder<TModel>
    • IModelErrorDetailsTestBuilder
    • IModelErrorDetailsTestBuilder<TModel>
    • IModelErrorTestBuilder
    • IModelErrorTestBuilder<TModel>
    • IModelStateTestBuilder
  • Options
    • IOptionsBuilder
  • Routing
    • IResolvedRouteTestBuilder
    • IRouteTestBuilder
    • IShouldMapTestBuilder
  • Services
    • IServicesBuilder
  • Uri
    • IUriBuilder
    • IUriTestBuilder
  • ViewComponentResults
    • IViewTestBuilder
  • ViewComponents
    • IViewComponentBuilder<TViewComponent>
    • IViewComponentTestBuilder

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 Source

ContainingCookie(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
  • Methods
    • ContainingCookie(Action<IResponseCookieTestBuilder>)
    • ContainingCookie(String)
    • ContainingCookie(String, String)
    • ContainingCookie(String, String, CookieOptions)
    • ContainingCookies(IDictionary<String, String>)
    • ContainingCookies(Object)
    • ContainingHeader(String)
    • ContainingHeader(String, StringValues)
    • ContainingHeader(String, IEnumerable<String>)
    • ContainingHeader(String, String)
    • ContainingHeader(String, String[])
    • ContainingHeaders(IHeaderDictionary)
    • ContainingHeaders(IDictionary<String, StringValues>)
    • ContainingHeaders(IDictionary<String, IEnumerable<String>>)
    • ContainingHeaders(IDictionary<String, String>)
    • ContainingHeaders(Object)
    • WithBody(Stream)
    • WithBody<TBody>(TBody, String)
    • WithBody<TBody>(TBody, String, Encoding)
    • WithBodyOfType<TBody>(String)
    • WithBodyOfType<TBody>(String, Encoding)
    • WithContentLength(Nullable<Int64>)
    • WithContentType(String)
    • WithJsonBody(String)
    • WithJsonBody(String, Encoding)
    • WithJsonBody<TBody>(TBody)
    • WithJsonBody<TBody>(TBody, Encoding)
    • WithStatusCode(Int32)
    • WithStatusCode(HttpStatusCode)
    • WithStringBody(String)
    • WithStringBody(String, Encoding)
Back to top Copyright © 2015-2016 MyTestedASP.NET. All Rights Reserved. Generated by DocFX