Interface IViewComponentShouldHaveTestBuilder<TInvocationResult>
Used for testing the view component's additional data - attributes, HTTP response, view bag and more.
Namespace:MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations
Assembly:MyTested.AspNetCore.Mvc.ViewComponents.dll
Syntax
public interface IViewComponentShouldHaveTestBuilder<TInvocationResult> : IBaseTestBuilderWithComponentShouldHaveTestBuilder<IAndViewComponentResultTestBuilder<TInvocationResult>>, IBaseTestBuilder
Type Parameters
Name | Description |
---|---|
TInvocationResult | Result from invoked view component in ASP.NET Core MVC. |
Methods
| Improve this Doc View SourceAttributes(Action<IViewComponentAttributesTestBuilder>)
Tests whether the view component has specific attributes.
Declaration
IAndViewComponentResultTestBuilder<TInvocationResult> Attributes(Action<IViewComponentAttributesTestBuilder> attributesTestBuilder)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IViewComponentAttributesTestBuilder> | attributesTestBuilder | Builder for testing specific attributes on the view component. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations.IAndViewComponentResultTestBuilder<TInvocationResult> | Test builder of MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations.IAndViewComponentResultTestBuilder`1 type. |
Attributes(Nullable<Int32>)
Tests whether the view component has at least 1 attribute of any type.
Declaration
IAndViewComponentResultTestBuilder<TInvocationResult> Attributes(int ? withTotalNumberOf = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | withTotalNumberOf | Optional parameter specifying the exact total number of attributes on the tested view component. |
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations.IAndViewComponentResultTestBuilder<TInvocationResult> | Test builder of MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations.IAndViewComponentResultTestBuilder`1 type. |
NoAttributes()
Tests whether the view component has no attributes of any type.
Declaration
IAndViewComponentResultTestBuilder<TInvocationResult> NoAttributes()
Returns
Type | Description |
---|---|
MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations.IAndViewComponentResultTestBuilder<TInvocationResult> | Test builder of MyTested.AspNetCore.Mvc.Builders.Contracts.Invocations.IAndViewComponentResultTestBuilder`1 type. |