Interface IControllerBuilder<TController>
Used for building the controller which will be tested.
Inherited Members
Namespace:MyTested.AspNetCore.Mvc.Builders.Contracts.Controllers
Assembly:MyTested.AspNetCore.Mvc.Controllers.dll
Syntax
public interface IControllerBuilder<TController> : IBaseTestBuilderWithComponentBuilder<IAndControllerBuilder<TController>>, IBaseTestBuilderWithComponent, IBaseTestBuilder where TController : class
Type Parameters
Name | Description |
---|---|
TController | Class representing ASP.NET Core MVC controller. |
Methods
| Improve this Doc View SourceCalling(Expression<Action<TController>>)
Indicates which action should be invoked and tested.
Declaration
IVoidActionResultTestBuilder Calling(Expression<Action<TController>> actionCall)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Action<TController>> | actionCall | Method call expression indicating invoked void action. |
Returns
Type | Description |
---|---|
IVoidActionResultTestBuilder | Test builder of IActionResultTestBuilder<TActionResult> type. |
Calling(Expression<Func<TController, Task>>)
Indicates which action should be invoked and tested.
Declaration
IVoidActionResultTestBuilder Calling(Expression<Func<TController, Task>> actionCall)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TController, System.Threading.Tasks.Task>> | actionCall | Method call expression indicating invoked asynchronous void action. |
Returns
Type | Description |
---|---|
IVoidActionResultTestBuilder | Test builder of IActionResultTestBuilder<TActionResult> type. |
Calling<TActionResult>(Expression<Func<TController, TActionResult>>)
Indicates which action should be invoked and tested.
Declaration
IActionResultTestBuilder<TActionResult> Calling<TActionResult>(Expression<Func<TController, TActionResult>> actionCall)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TController, TActionResult>> | actionCall | Method call expression indicating invoked action. |
Returns
Type | Description |
---|---|
IActionResultTestBuilder<TActionResult> | Test builder of IActionResultTestBuilder<TActionResult> type. |
Type Parameters
Name | Description |
---|---|
TActionResult | Type of result from action. |
Calling<TActionResult>(Expression<Func<TController, Task<TActionResult>>>)
Indicates which action should be invoked and tested.
Declaration
IActionResultTestBuilder<TActionResult> Calling<TActionResult>(Expression<Func<TController, Task<TActionResult>>> actionCall)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TController, System.Threading.Tasks.Task<TActionResult>>> | actionCall | Method call expression indicating invoked asynchronous action. |
Returns
Type | Description |
---|---|
IActionResultTestBuilder<TActionResult> | Test builder of IActionResultTestBuilder<TActionResult> type. |
Type Parameters
Name | Description |
---|---|
TActionResult | Type of result from action. |
ShouldHave()
Used for testing controller additional details.
Declaration
IControllerTestBuilder ShouldHave()
Returns
Type | Description |
---|---|
IControllerTestBuilder | Test builder of IControllerTestBuilder type. |
WithActionContext(ActionContext)
Sets the ActionContext on the tested controller.
Declaration
IAndControllerBuilder<TController> WithActionContext(ActionContext actionContext)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.ActionContext | actionContext | Instance of ActionContext to set. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Controllers.IAndControllerBuilder<TController> | The same IControllerBuilder<TController>. |
WithActionContext(Action<ActionContext>)
Sets the ActionContext on the tested controller.
Declaration
IAndControllerBuilder<TController> WithActionContext(Action<ActionContext> actionContextSetup)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.AspNetCore.Mvc.ActionContext> | actionContextSetup | Action setting the ActionContext. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Controllers.IAndControllerBuilder<TController> | The same IControllerBuilder<TController>. |
WithControllerContext(ControllerContext)
Sets the ControllerContext on the tested controller.
Declaration
IAndControllerBuilder<TController> WithControllerContext(ControllerContext controllerContext)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.ControllerContext | controllerContext | Instance of ControllerContext to set. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Controllers.IAndControllerBuilder<TController> | The same IControllerBuilder<TController>. |
WithControllerContext(Action<ControllerContext>)
Sets the ControllerContext on the tested controller.
Declaration
IAndControllerBuilder<TController> WithControllerContext(Action<ControllerContext> controllerContextSetup)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.AspNetCore.Mvc.ControllerContext> | controllerContextSetup | Action setting the ControllerContext. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Controllers.IAndControllerBuilder<TController> | The same IControllerBuilder<TController>. |
WithSetup(Action<TController>)
Sets custom properties to the controller using a delegate.
Declaration
IAndControllerBuilder<TController> WithSetup(Action<TController> controllerSetup)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TController> | controllerSetup | Action to use for controller setup. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Controllers.IAndControllerBuilder<TController> | The same IControllerBuilder<TController>. |