Interface IJsonTestBuilder
Used for testing Microsoft.AspNetCore.Mvc.JsonResult.
Inherited Members
Namespace:MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json
Assembly:MyTested.AspNetCore.Mvc.ViewActionResults.dll
Syntax
public interface IJsonTestBuilder : IBaseTestBuilderWithResponseModel, IBaseTestBuilderWithActionResult<JsonResult>, IBaseTestBuilderWithInvokedAction, IBaseTestBuilderWithAction, IBaseTestBuilderWithComponent, IBaseTestBuilder
Methods
| Improve this Doc View SourceWithContentType(MediaTypeHeaderValue)
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has the same content type as the provided MediaTypeHeaderValue.
Declaration
IAndJsonTestBuilder WithContentType(MediaTypeHeaderValue contentType)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Net.Http.Headers.MediaTypeHeaderValue | contentType | Content type as MediaTypeHeaderValue. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |
WithContentType(String)
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has the same content type as the provided string.
Declaration
IAndJsonTestBuilder WithContentType(string contentType)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentType | ContentType type as string. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |
WithDefaulJsonSerializerSettings()
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has the default JsonSerializerSettings.
Declaration
IAndJsonTestBuilder WithDefaulJsonSerializerSettings()
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |
WithJsonSerializerSettings(JsonSerializerSettings)
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has the provided JsonSerializerSettings.
Declaration
IAndJsonTestBuilder WithJsonSerializerSettings(JsonSerializerSettings jsonSerializerSettings)
Parameters
Type | Name | Description |
---|---|---|
Newtonsoft.Json.JsonSerializerSettings | jsonSerializerSettings | Expected JsonSerializerSettings to test with. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |
WithJsonSerializerSettings(Action<IJsonSerializerSettingsTestBuilder>)
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has JsonSerializerSettings by using builder.
Declaration
IAndJsonTestBuilder WithJsonSerializerSettings(Action<IJsonSerializerSettingsTestBuilder> jsonSerializerSettingsBuilder)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IJsonSerializerSettingsTestBuilder> | jsonSerializerSettingsBuilder | Builder for creating JsonSerializerSettings. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |
WithStatusCode(Int32)
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has the same status code as the provided one.
Declaration
IAndJsonTestBuilder WithStatusCode(int statusCode)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | statusCode | Status code as integer. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |
WithStatusCode(HttpStatusCode)
Tests whether Microsoft.AspNetCore.Mvc.JsonResult has the same status code as the provided HttpStatusCode.
Declaration
IAndJsonTestBuilder WithStatusCode(HttpStatusCode statusCode)
Parameters
Type | Name | Description |
---|---|---|
System.Net.HttpStatusCode | statusCode | HttpStatusCode enumeration. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.Json.IAndJsonTestBuilder. |