Interface IViewComponentBuilder<TViewComponent>
Used for building the view component which will be tested.
Inherited Members
Namespace:MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents
Assembly:MyTested.AspNetCore.Mvc.ViewComponents.dll
Syntax
public interface IViewComponentBuilder<TViewComponent> : IBaseTestBuilderWithComponentBuilder<IAndViewComponentBuilder<TViewComponent>>, IBaseTestBuilderWithComponent, IBaseTestBuilder where TViewComponent : class
Type Parameters
Name | Description |
---|---|
TViewComponent | Class representing ASP.NET Core MVC view component. |
Methods
| Improve this Doc View SourceInvokedWith<TInvocationResult>(Expression<Func<TViewComponent, TInvocationResult>>)
Indicates which view component method should be invoked and tested.
Declaration
IViewComponentResultTestBuilder<TInvocationResult> InvokedWith<TInvocationResult>(Expression<Func<TViewComponent, TInvocationResult>> invocationCall)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TViewComponent, TInvocationResult>> | invocationCall | Method call expression indicating invoked method. |
Returns
Type | Description |
---|---|
IViewComponentResultTestBuilder<TInvocationResult> | Test builder of IViewComponentResultTestBuilder<TInvocationResult> type. |
Type Parameters
Name | Description |
---|---|
TInvocationResult | Type of result from the invocation. |
InvokedWith<TInvocationResult>(Expression<Func<TViewComponent, Task<TInvocationResult>>>)
Indicates which view component method should be invoked and tested.
Declaration
IViewComponentResultTestBuilder<TInvocationResult> InvokedWith<TInvocationResult>(Expression<Func<TViewComponent, Task<TInvocationResult>>> invocationCall)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression<System.Func<TViewComponent, System.Threading.Tasks.Task<TInvocationResult>>> | invocationCall | Method call expression indicating invoked asynchronous method. |
Returns
Type | Description |
---|---|
IViewComponentResultTestBuilder<TInvocationResult> | Test builder of IViewComponentResultTestBuilder<TInvocationResult> type. |
Type Parameters
Name | Description |
---|---|
TInvocationResult | Type of result from the invocation. |
ShouldHave()
Used for testing view component additional details.
Declaration
IViewComponentTestBuilder ShouldHave()
Returns
Type | Description |
---|---|
IViewComponentTestBuilder | Test builder of IViewComponentTestBuilder type. |
WithActionContext(ActionContext)
Sets the ActionContext on the tested view component.
Declaration
IAndViewComponentBuilder<TViewComponent> 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.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |
WithActionContext(Action<ActionContext>)
Sets the ActionContext on the tested controller.
Declaration
IAndViewComponentBuilder<TViewComponent> 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.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |
WithSetup(Action<TViewComponent>)
Sets custom properties to the view component using a delegate.
Declaration
IAndViewComponentBuilder<TViewComponent> WithSetup(Action<TViewComponent> viewComponentSetup)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TViewComponent> | viewComponentSetup | Action to use for view component setup. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |
WithViewComponentContext(ViewComponentContext)
Sets the ViewComponentContext on the tested view component.
Declaration
IAndViewComponentBuilder<TViewComponent> WithViewComponentContext(ViewComponentContext viewComponentContext)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext | viewComponentContext | Instance of ViewComponentContext to set. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |
WithViewComponentContext(Action<ViewComponentContext>)
Sets the ViewComponentContext on the tested controller.
Declaration
IAndViewComponentBuilder<TViewComponent> WithViewComponentContext(Action<ViewComponentContext> viewComponentContextSetup)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.AspNetCore.Mvc.ViewComponents.ViewComponentContext> | viewComponentContextSetup | Action setting the ViewComponentContext. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |
WithViewContext(ViewContext)
Sets the ViewContext on the tested view component.
Declaration
IAndViewComponentBuilder<TViewComponent> WithViewContext(ViewContext viewContext)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Mvc.Rendering.ViewContext | viewContext | Instance of ViewContext to set. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |
WithViewContext(Action<ViewContext>)
Sets the ViewContext on the tested controller.
Declaration
IAndViewComponentBuilder<TViewComponent> WithViewContext(Action<ViewContext> viewContextSetup)
Parameters
Type | Name | Description |
---|---|---|
System.Action<Microsoft.AspNetCore.Mvc.Rendering.ViewContext> | viewContextSetup | Action setting the ViewContext. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents.IAndViewComponentBuilder<TViewComponent> | The same IViewComponentBuilder<TViewComponent>. |