Table of Contents

Class BlazorComponentParametersBuilder<TComponent>

Namespace
Dmnk.Blazor.InteractiveTests.Api
Assembly
Dmnk.Blazor.InteractiveTests.Api.dll

This class helps you build up a dictionary of parameters for a given blazor component.

You shouldn't need to instantiate this directly. Instead, you are expected to use it in BlazorInteractiveTestRunner's ShowComponent method(s).

public sealed class BlazorComponentParametersBuilder<TComponent> where TComponent : ComponentBase

Type Parameters

TComponent

The type of the blazor component

Inheritance
BlazorComponentParametersBuilder<TComponent>
Inherited Members

Constructors

BlazorComponentParametersBuilder()

public BlazorComponentParametersBuilder()

Methods

Add<TValue>(Expression<Func<TComponent, TValue>>, TValue)

Add a parameter.

public BlazorComponentParametersBuilder<TComponent> Add<TValue>(Expression<Func<TComponent, TValue>> selector, TValue value)

Parameters

selector Expression<Func<TComponent, TValue>>

An expression selecting a [Parameter] property of the component.

value TValue

The value that selector(myComponent) should be set to

Returns

BlazorComponentParametersBuilder<TComponent>

Type Parameters

TValue

Examples

BlazorInteractiveTestRunner.ShowComponent<MyComponent>(
    params => params
        .Add(component => component.MyParameter, 4)
        .Add(component => component.MyOtherParameter, "hi"));

Build()

Returns the current built up dictionary of parameters.

You shouldn't need to call this yourself. It is really only public if you need it for some debugging / sanity-check purpose.

public Dictionary<string, object?> Build()

Returns

Dictionary<string, object>