Class BadRequestTestBuilderDataAnnotationsExtensions
Contains ModelStateDictionary extension methods for IBadRequestTestBuilder.
Inheritance
Namespace:MyTested.AspNetCore.Mvc
Assembly:MyTested.AspNetCore.Mvc.DataAnnotations.dll
Syntax
public static class BadRequestTestBuilderDataAnnotationsExtensions
Methods
| Improve this Doc View SourceWithModelStateError(IBadRequestTestBuilder)
Tests whether Microsoft.AspNetCore.Mvc.BadRequestObjectResult contains the controller's ModelStateDictionary as object error.
Declaration
public static IAndBadRequestTestBuilder WithModelStateError(this IBadRequestTestBuilder badRequestTestBuilder)
Parameters
Type | Name | Description |
---|---|---|
IBadRequestTestBuilder | badRequestTestBuilder | Instance of IBadRequestTestBuilder type. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.BadRequest.IAndBadRequestTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.BadRequest.IAndBadRequestTestBuilder. |
WithModelStateError(IBadRequestTestBuilder, ModelStateDictionary)
Tests whether Microsoft.AspNetCore.Mvc.BadRequestObjectResult contains specific ModelStateDictionary.
Declaration
public static IAndBadRequestTestBuilder WithModelStateError(this IBadRequestTestBuilder badRequestTestBuilder, ModelStateDictionary modelState)
Parameters
Type | Name | Description |
---|---|---|
IBadRequestTestBuilder | badRequestTestBuilder | Instance of IBadRequestTestBuilder type. |
Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary | modelState | ModelStateDictionary to deeply compare to the actual one. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.BadRequest.IAndBadRequestTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.BadRequest.IAndBadRequestTestBuilder. |
WithModelStateError(IBadRequestTestBuilder, Action<IModelStateTestBuilder>)
Tests whether Microsoft.AspNetCore.Mvc.BadRequestObjectResult contains specific model state errors using test builder.
Declaration
public static IAndBadRequestTestBuilder WithModelStateError(this IBadRequestTestBuilder badRequestTestBuilder, Action<IModelStateTestBuilder> modelStateTestBuilder)
Parameters
Type | Name | Description |
---|---|---|
IBadRequestTestBuilder | badRequestTestBuilder | Instance of IBadRequestTestBuilder type. |
System.Action<IModelStateTestBuilder> | modelStateTestBuilder | Model state errors test builder. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.BadRequest.IAndBadRequestTestBuilder | The same MyTested.AspNetCore.Mvc.Builders.Contracts.ActionResults.BadRequest.IAndBadRequestTestBuilder. |