Table of Contents

Class ComponentParameterFactory

Namespace
Bunit
Assembly
Bunit.Core.dll

ComponentParameter factory methods.

public static class ComponentParameterFactory
Inheritance
ComponentParameterFactory
Inherited Members

Methods

CascadingValue(object)

Creates a cascading value which can be passed to a test contexts render methods.

public static ComponentParameter CascadingValue(object value)

Parameters

value object

Value of the parameter.

Returns

ComponentParameter

The ComponentParameter.

CascadingValue(string, object)

Creates a cascading value which can be passed to a test contexts render methods.

public static ComponentParameter CascadingValue(string name, object value)

Parameters

name string

Parameter name.

value object

Value of the parameter.

Returns

ComponentParameter

The ComponentParameter.

ChildContent(RenderFragment)

Creates a ChildContent parameter that will pass the provided renderFragment to the parameter in the component.

public static ComponentParameter ChildContent(RenderFragment renderFragment)

Parameters

renderFragment RenderFragment

The RenderFragment to pass to the ChildContent parameter.

Returns

ComponentParameter

The ComponentParameter.

ChildContent(string)

Creates a ChildContent RenderFragment with the provided markup as rendered output.

public static ComponentParameter ChildContent(string markup)

Parameters

markup string

Markup to pass to the child content parameter.

Returns

ComponentParameter

The ComponentParameter.

ChildContent<TComponent>(params ComponentParameter[])

Creates a ChildContent RenderFragment which will render a TComponent component with the provided parameters as input.

public static ComponentParameter ChildContent<TComponent>(params ComponentParameter[] parameters) where TComponent : class, IComponent

Parameters

parameters ComponentParameter[]

Parameters to pass to the TComponent.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TComponent

The type of the component to render with the RenderFragment.

EventCallback(string, Action)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback(string name, Action callback)

Parameters

name string

Parameter name.

callback Action

The event callback.

Returns

ComponentParameter

The ComponentParameter.

EventCallback(string, Action<object>)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback(string name, Action<object> callback)

Parameters

name string

Parameter name.

callback Action<object>

The event callback.

Returns

ComponentParameter

The ComponentParameter.

EventCallback(string, Func<object, Task>)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback(string name, Func<object, Task> callback)

Parameters

name string

Parameter name.

callback Func<object, Task>

The event callback.

Returns

ComponentParameter

The ComponentParameter.

EventCallback(string, Func<Task>)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback(string name, Func<Task> callback)

Parameters

name string

Parameter name.

callback Func<Task>

The event callback.

Returns

ComponentParameter

The ComponentParameter.

EventCallback<TValue>(string, Action)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback<TValue>(string name, Action callback)

Parameters

name string

Parameter name.

callback Action

The event callback.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TValue

The value returned in the EventCallback<TValue>.

EventCallback<TValue>(string, Action<TValue>)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback<TValue>(string name, Action<TValue> callback)

Parameters

name string

Parameter name.

callback Action<TValue>

The event callback.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TValue

The value returned in the EventCallback<TValue>.

EventCallback<TValue>(string, Func<Task>)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback<TValue>(string name, Func<Task> callback)

Parameters

name string

Parameter name.

callback Func<Task>

The event callback.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TValue

The value returned in the EventCallback<TValue>.

EventCallback<TValue>(string, Func<TValue, Task>)

Creates a ComponentParameter with an EventCallback that will call the provided callback.

public static ComponentParameter EventCallback<TValue>(string name, Func<TValue, Task> callback)

Parameters

name string

Parameter name.

callback Func<TValue, Task>

The event callback.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TValue

The value returned in the EventCallback<TValue>.

Parameter(string, object?)

Creates a component parameter which can be passed to a test contexts render methods.

public static ComponentParameter Parameter(string name, object? value)

Parameters

name string

Parameter name.

value object

Value or null of the parameter.

Returns

ComponentParameter

The ComponentParameter.

RenderFragment(string, string)

Creates a RenderFragment with the provided markup as rendered output and passes it to the parameter specified in name.

public static ComponentParameter RenderFragment(string name, string markup)

Parameters

name string

Parameter name.

markup string

Markup to pass to the render fragment parameter.

Returns

ComponentParameter

The ComponentParameter.

RenderFragment<TComponent>(string, params ComponentParameter[])

Creates a RenderFragment which will render a TComponent component with the provided parameters as input, and passes it to the parameter specified in name.

public static ComponentParameter RenderFragment<TComponent>(string name, params ComponentParameter[] parameters) where TComponent : class, IComponent

Parameters

name string

Parameter name.

parameters ComponentParameter[]

Parameters to pass to the TComponent.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TComponent

The type of the component to render with the RenderFragment.

Template<TValue>(string, RenderFragment<TValue>)

Creates a template component parameter which will pass the template RenderFragment<TValue> to the parameter with the name name.

public static ComponentParameter Template<TValue>(string name, RenderFragment<TValue> template)

Parameters

name string

Parameter name.

template RenderFragment<TValue>

RenderFragment<TValue> to pass to the parameter.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TValue

The value used to build the content.

Template<TValue>(string, Func<TValue, string>)

Creates a template component parameter which will pass the a RenderFragment<TValue> to the parameter with the name name. The markupFactory will be used to generate the markup inside the template.

public static ComponentParameter Template<TValue>(string name, Func<TValue, string> markupFactory)

Parameters

name string

Parameter name.

markupFactory Func<TValue, string>

A markup factory that takes a TValue as input and returns markup/HTML.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TValue

The value used to build the content.

Template<TComponent, TValue>(string, Func<TValue, ComponentParameter[]>)

Creates a template component parameter which will pass the a RenderFragment<TValue> to the parameterCollectionBuilder at runtime. The parameters returned from it will be passed to the TComponent and it will be rendered as the template.

public static ComponentParameter Template<TComponent, TValue>(string name, Func<TValue, ComponentParameter[]> parameterCollectionBuilder) where TComponent : IComponent

Parameters

name string

Parameter name.

parameterCollectionBuilder Func<TValue, ComponentParameter[]>

The parameter collection builder function that will be passed the template TValue.

Returns

ComponentParameter

The ComponentParameter.

Type Parameters

TComponent

The type of component to render in template.

TValue

The value used to build the content.

Progress Telerik

Premium sponsor: Progress Telerik.

Packt

Editorial support provided by Packt.

.NET Foundation

Supported by the .NET Foundation.