MY TESTED ASP.NET CORE MVC DOCS
  • Tutorial
  • Testing Guide
  • API Reference
  • Troubleshoot
  • About
  • API Reference
  • MyTested.AspNetCore.Mvc.Builders.Contracts.ViewComponents
  • IViewComponentBuilder<TViewComponent>
Show / Hide Table of Contents
  • Common Classes & Extensions
    • ActionAttributesTestBuilderViewFeaturesExtensions
    • AuthenticationScheme
    • BadRequestTestBuilderDataAnnotationsExtensions
    • BadRequestTestBuilderExtensions
    • BaseShouldReturnTestBuilderExtensions
    • BaseTestBuilderWithResponseModelExtensions
    • ComponentBuilderAuthenticationExtensions
    • ComponentBuilderCachingExtensions
    • ComponentBuilderDependencyInjectionExtensions
    • ComponentBuilderEntityFrameworkCoreExtensions
    • ComponentBuilderHttpExtensions
    • ComponentBuilderOptionsExtensions
    • ComponentBuilderRoutingExtensions
    • ComponentBuilderSessionExtensions
    • ComponentBuilderTempDataExtensions
    • ComponentShouldHaveTestBuilderCachingExtensions
    • ComponentShouldHaveTestBuilderEntityFrameworkCoreExtensions
    • ComponentShouldHaveTestBuilderHttpExtensions
    • ComponentShouldHaveTestBuilderModelStateExtensions
    • ComponentShouldHaveTestBuilderSessionExtensions
    • ComponentShouldHaveTestBuilderTempDataExtensions
    • ComponentShouldHaveTestBuilderViewBagExtensions
    • ComponentShouldHaveTestBuilderViewDataExtensions
    • ContentType
    • ControllerBuilderDataAnnotationsExtensions
    • CreatedTestBuilderExtensions
    • From
    • HttpHeader
    • HttpMethod
    • HttpRequestBuilderAuthenticationExtensions
    • HttpRequestBuilderViewFeaturesExtensions
    • HttpScheme
    • HttpStatusCode
    • LocalRedirectTestBuilderExtensions
    • ModelErrorDetailsTestBuilderViewFeaturesExtensions
    • ModelErrorTestBuilderViewFeaturesExtensions
    • MyApplication
    • MyController<TController>
    • MyMvc
    • MyRouting
    • MyViewComponent<TViewComponent>
    • RedirectTestBuilderExtensions
    • ResolvedRouteTestBuilderDataAnnotationsExtensions
    • ServiceCollectionAbstractionsExtensions
    • ServiceCollectionCachingExtensions
    • ServiceCollectionControllersExtensions
    • ServiceCollectionCoreExtensions
    • ServiceCollectionEntityFrameworkCoreExtensions
    • ServiceCollectionExtensions
    • ServiceCollectionHttpExtensions
    • ServiceCollectionOptionsExtensions
    • ServiceCollectionRoutingExtensions
    • ServiceCollectionSessionExtensions
    • ServiceCollectionTempDataExtensions
    • ServiceCollectionUniverseExtensions
    • ServiceCollectionViewComponentsExtensions
    • ServiceCollectionViewFeaturesExtensions
    • ShouldReturnTestBuilderExtensions
    • ShouldReturnTestBuilderJsonResultExtensions
    • ShouldReturnTestBuilderPartialViewResultExtensions
    • ShouldReturnTestBuilderViewComponentResultExtensions
    • ShouldReturnTestBuilderViewResultExtensions
    • ViewComponentShouldReturnTestBuilderExtensions
    • With
  • ActionResults.BadRequest
    • IBadRequestErrorMessageTestBuilder
    • IBadRequestTestBuilder
  • ActionResults.Challenge
    • IChallengeTestBuilder
  • ActionResults.Content
    • IContentTestBuilder
  • ActionResults.Created
    • ICreatedTestBuilder
  • ActionResults.File
    • IFileTestBuilder
    • IPhysicalFileTestBuilder
  • ActionResults.Forbid
    • IForbidTestBuilder
  • ActionResults.Json
    • IJsonSerializerSettingsTestBuilder
    • IJsonTestBuilder
  • ActionResults.LocalRedirect
    • ILocalRedirectTestBuilder
  • ActionResults.NotFound
    • INotFoundTestBuilder
  • ActionResults.Object
    • IObjectTestBuilder
  • ActionResults.Ok
    • IOkTestBuilder
  • ActionResults.Redirect
    • IRedirectTestBuilder
  • ActionResults.StatusCode
    • IStatusCodeTestBuilder
  • ActionResults.View
    • IViewComponentTestBuilder
    • IViewTestBuilder
  • Actions
    • IActionResultTestBuilder<TActionResult>
    • IShouldHaveTestBuilder<TActionResult>
    • IShouldReturnTestBuilder<TActionResult>
    • IVoidActionResultTestBuilder
  • Application
    • IApplicationConfigurationBuilder
  • Attributes
    • IActionAttributesTestBuilder
    • IBaseAttributesTestBuilder<TAttributesTestBuilder>
    • IControllerActionAttributesTestBuilder<TAttributesTestBuilder>
    • IControllerAttributesTestBuilder
    • IViewComponentAttributesTestBuilder
  • Authentication
    • IAuthenticationPropertiesTestBuilder
    • IClaimsIdentityBuilder
    • IClaimsPrincipalBuilder
  • Base
    • IBaseTestBuilder
    • IBaseTestBuilderWithAction
    • IBaseTestBuilderWithActionResult<TActionResult>
    • IBaseTestBuilderWithComponent
    • IBaseTestBuilderWithComponentBuilder<TBuilder>
    • IBaseTestBuilderWithComponentShouldHaveTestBuilder<TBuilder>
    • IBaseTestBuilderWithController
    • IBaseTestBuilderWithInvokedAction
    • IBaseTestBuilderWithModel<TModel>
    • IBaseTestBuilderWithModelError
    • IBaseTestBuilderWithResponseModel
    • IBaseTestBuilderWithViewComponent
    • IBaseTestBuilderWithViewComponentInvocation
    • IBaseTestBuilderWithViewComponentResult<TInvocationResult>
  • CaughtExceptions
    • IAggregateExceptionTestBuilder
    • IBaseExceptionTestBuilder
    • IExceptionMessageTestBuilder
    • IExceptionTestBuilder
    • IShouldThrowTestBuilder
  • Controllers
    • IControllerBuilder<TController>
    • IControllerTestBuilder
  • Data
    • IDataProviderEntryDetailsTestBuilder<TValue>
    • IDataProviderEntryKeyTestBuilder
    • IDataProviderEntryTestBuilder
    • IDbContextBuilder
    • IDbContextTestBuilder
    • IMemoryCacheBuilder
    • IMemoryCacheEntryBuilder
    • IMemoryCacheEntryDetailsTestBuilder<TValue>
    • IMemoryCacheEntryKeyBuilder
    • IMemoryCacheEntryKeyTestBuilder
    • IMemoryCacheEntryTestBuilder
    • IMemoryCacheTestBuilder
    • ISessionBuilder
    • ISessionTestBuilder
    • ITempDataBuilder
    • ITempDataTestBuilder
    • IViewBagTestBuilder
    • IViewDataTestBuilder
  • Http
    • IHttpRequestBuilder
    • IHttpResponseTestBuilder
    • IResponseCookieTestBuilder
  • Invocations
    • IBaseShouldReturnTestBuilder
    • IBaseShouldReturnTestBuilder<TInvocationResult, TBuilder>
    • IBaseShouldReturnTestBuilder<TInvocationResult>
    • IViewComponentResultTestBuilder<TInvocationResult>
    • IViewComponentShouldHaveTestBuilder<TInvocationResult>
    • IViewComponentShouldReturnTestBuilder<TInvocationResult>
  • Models
    • IModelDetailsTestBuilder<TModel>
    • IModelErrorDetailsTestBuilder
    • IModelErrorDetailsTestBuilder<TModel>
    • IModelErrorTestBuilder
    • IModelErrorTestBuilder<TModel>
    • IModelStateTestBuilder
  • Options
    • IOptionsBuilder
  • Routing
    • IResolvedRouteTestBuilder
    • IRouteTestBuilder
    • IShouldMapTestBuilder
  • Services
    • IServicesBuilder
  • Uri
    • IUriBuilder
    • IUriTestBuilder
  • ViewComponentResults
    • IViewTestBuilder
  • ViewComponents
    • IViewComponentBuilder<TViewComponent>
    • IViewComponentTestBuilder

Interface IViewComponentBuilder<TViewComponent>

Used for building the view component which will be tested.

Inherited Members
IBaseTestBuilderWithComponent.ShouldPassForThe<TComponent>(Action<TComponent>)
IBaseTestBuilderWithComponent.ShouldPassForThe<TComponent>(Func<TComponent, Boolean>)
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 Source

InvokedWith<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.
| Improve this Doc View Source

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.
| Improve this Doc View Source

ShouldHave()

Used for testing view component additional details.

Declaration
IViewComponentTestBuilder ShouldHave()
Returns
Type Description
IViewComponentTestBuilder

Test builder of IViewComponentTestBuilder type.

| Improve this Doc View Source

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>.

| Improve this Doc View Source

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>.

| Improve this Doc View Source

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>.

| Improve this Doc View Source

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>.

| Improve this Doc View Source

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>.

| Improve this Doc View Source

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>.

| Improve this Doc View Source

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>.

Extension Methods

ComponentBuilderSessionExtensions.WithSession<IAndViewComponentBuilder<TViewComponent>>(Action<ISessionBuilder>)
ComponentBuilderDependencyInjectionExtensions.WithServices<IAndViewComponentBuilder<TViewComponent>>(Action<IServicesBuilder>)
ComponentBuilderDependencyInjectionExtensions.WithServices<IAndViewComponentBuilder<TViewComponent>>(IEnumerable<Object>)
ComponentBuilderDependencyInjectionExtensions.WithServices<IAndViewComponentBuilder<TViewComponent>>(Object[])
ComponentBuilderHttpExtensions.WithHttpContext<IAndViewComponentBuilder<TViewComponent>>(HttpContext)
ComponentBuilderHttpExtensions.WithHttpContext<IAndViewComponentBuilder<TViewComponent>>(Action<HttpContext>)
ComponentBuilderHttpExtensions.WithHttpRequest<IAndViewComponentBuilder<TViewComponent>>(HttpRequest)
ComponentBuilderHttpExtensions.WithHttpRequest<IAndViewComponentBuilder<TViewComponent>>(Action<IHttpRequestBuilder>)
ComponentBuilderCachingExtensions.WithMemoryCache<IAndViewComponentBuilder<TViewComponent>>(Action<IMemoryCacheBuilder>)
ComponentBuilderOptionsExtensions.WithOptions<IAndViewComponentBuilder<TViewComponent>>(Action<IOptionsBuilder>)
ComponentBuilderRoutingExtensions.WithRouteData<IAndViewComponentBuilder<TViewComponent>>()
ComponentBuilderRoutingExtensions.WithRouteData<IAndViewComponentBuilder<TViewComponent>>(Object)
ComponentBuilderAuthenticationExtensions.WithAuthenticatedUser<IAndViewComponentBuilder<TViewComponent>>()
ComponentBuilderAuthenticationExtensions.WithAuthenticatedUser<IAndViewComponentBuilder<TViewComponent>>(Action<IClaimsPrincipalBuilder>)
ComponentBuilderEntityFrameworkCoreExtensions.WithDbContext<IAndViewComponentBuilder<TViewComponent>>(Action<IDbContextBuilder>)
ComponentBuilderTempDataExtensions.WithTempData<IAndViewComponentBuilder<TViewComponent>>(Action<ITempDataBuilder>)
  • Improve this Doc
  • View Source
In This Article
  • Methods
    • InvokedWith<TInvocationResult>(Expression<Func<TViewComponent, TInvocationResult>>)
    • InvokedWith<TInvocationResult>(Expression<Func<TViewComponent, Task<TInvocationResult>>>)
    • ShouldHave()
    • WithActionContext(ActionContext)
    • WithActionContext(Action<ActionContext>)
    • WithSetup(Action<TViewComponent>)
    • WithViewComponentContext(ViewComponentContext)
    • WithViewComponentContext(Action<ViewComponentContext>)
    • WithViewContext(ViewContext)
    • WithViewContext(Action<ViewContext>)
  • Extension Methods
Back to top Copyright © 2015-2016 MyTestedASP.NET. All Rights Reserved. Generated by DocFX