Class ComponentShouldHaveTestBuilderModelStateExtensions
Contains ModelStateDictionary extension methods for IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder>.
Inheritance
Namespace:MyTested.AspNetCore.Mvc
Assembly:MyTested.AspNetCore.Mvc.ModelState.dll
Syntax
public static class ComponentShouldHaveTestBuilderModelStateExtensions
Methods
| Improve this Doc View SourceInvalidModelState<TBuilder>(IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder>, Nullable<Int32>)
Tests whether the action has invalid ModelStateDictionary.
Declaration
public static TBuilder InvalidModelState<TBuilder>(this IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> builder, int ? withNumberOfErrors = null)where TBuilder : IBaseTestBuilder
Parameters
Type | Name | Description |
---|---|---|
IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> | builder | Instance of IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> type. |
System.Nullable<System.Int32> | withNumberOfErrors | Expected number of ModelStateDictionary errors. If default null is provided, the test builder checks only if any errors are found. |
Returns
Type | Description |
---|---|
TBuilder | The same component should have test builder. |
Type Parameters
Name | Description |
---|---|
TBuilder | Class representing ASP.NET Core MVC test builder. |
ModelState<TBuilder>(IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder>, Action<IModelStateTestBuilder>)
Tests whether the component has specific ModelStateDictionary errors.
Declaration
public static TBuilder ModelState<TBuilder>(this IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> builder, Action<IModelStateTestBuilder> modelStateTestBuilder)where TBuilder : IBaseTestBuilder
Parameters
Type | Name | Description |
---|---|---|
IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> | builder | Instance of IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> type. |
System.Action<IModelStateTestBuilder> | modelStateTestBuilder | Builder for testing specific ModelStateDictionary errors. |
Returns
Type | Description |
---|---|
TBuilder | The same component should have test builder. |
Type Parameters
Name | Description |
---|---|
TBuilder | Class representing ASP.NET Core MVC test builder. |
ValidModelState<TBuilder>(IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder>)
Tests whether the component has valid ModelStateDictionary with no errors.
Declaration
public static TBuilder ValidModelState<TBuilder>(this IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> builder)where TBuilder : IBaseTestBuilder
Parameters
Type | Name | Description |
---|---|---|
IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> | builder | Instance of IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder> type. |
Returns
Type | Description |
---|---|
TBuilder | The same component should have test builder. |
Type Parameters
Name | Description |
---|---|
TBuilder | Class representing ASP.NET Core MVC test builder. |