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
valueobjectValue of the parameter.
Returns
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
Returns
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
renderFragmentRenderFragmentThe RenderFragment to pass to the ChildContent parameter.
Returns
ChildContent(string)
Creates a ChildContent RenderFragment with the provided
markup as rendered output.
public static ComponentParameter ChildContent(string markup)
Parameters
markupstringMarkup to pass to the child content parameter.
Returns
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
parametersComponentParameter[]Parameters to pass to the
TComponent.
Returns
Type Parameters
TComponentThe 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
Returns
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
Returns
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
Returns
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
Returns
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
Returns
Type Parameters
TValueThe 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
Returns
Type Parameters
TValueThe 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
Returns
Type Parameters
TValueThe 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
Returns
Type Parameters
TValueThe 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
Returns
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
Returns
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
namestringParameter name.
parametersComponentParameter[]Parameters to pass to the
TComponent.
Returns
Type Parameters
TComponentThe 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
namestringParameter name.
templateRenderFragment<TValue>RenderFragment<TValue> to pass to the parameter.
Returns
Type Parameters
TValueThe 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
namestringParameter name.
markupFactoryFunc<TValue, string>A markup factory that takes a
TValueas input and returns markup/HTML.
Returns
Type Parameters
TValueThe 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
namestringParameter name.
parameterCollectionBuilderFunc<TValue, ComponentParameter[]>The parameter collection builder function that will be passed the template
TValue.
Returns
Type Parameters
TComponentThe type of component to render in template.
TValueThe value used to build the content.