Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add support for Assets #1846

Copy link
Copy link

Description

@LasseHerget
Issue body actions

Hey,

I need to test a component that iterates over the Assets property.
I am currently struggling to figure out how to seed these Assets in bunit.

I already saw that this has been suggested for net9.0, and I am working in net10.0.
However that issue has been closed, because the usecase under test was (probably) appending the hash to the path.
#1612

But my usecase to test is an iteration over these assets.

So my question is:
How exactly would I correctly set these assets up in bUnit?

Scenario

public partial class AssetComponent : ComponentBase
{
    private IReadOnlyList<string> SubresourceNames { get; set; } 
   
    protected override void OnInitialized()
    {
        SubresourceNames = Assets
            .Select(asset => asset.Properties?.Single(property => property.Name == "label")?.Value) // The "label" property contains the relative file path.
            .Where( .. )
            .ToList();
    }
}
@foreach (var assetName in SubresourceNames)
{
  <DoStuff attribute="@assetName" />
}
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

needs designMore design is needed before this issue should result in a feature being implemented.More design is needed before this issue should result in a feature being implemented.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.