Skip to content

Add a component parameter builder or make param helpers more easily accessible #36

@egil

Description

@egil

Related to #5, where support for new test libs is planned, it will probably be a good idea to make it easier for users wanting to pass parameters to CUTs to do so without having to inherit from a base class in their tests, e.g. following the pattern of:

public void TestMethod()
{
    using var ctx = new TestContext();
    var params = new ComponentParameterBuilder(this) // 'this' might be needed to capture the execution context for callback parameters.
        .With("name", value)
        .WithCallback("name", () => {})
        .WithCascadingValue(obj)
        .WithChildContent("<p>hello world</p>")
        // ... etc
        .Build(); // Build could be done implicitly through a implicit conversion to ComponentParameter[]
    ctx.RenderComponent(params);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions