0

I've got code like this in a blazor component...

<MyComponent OnSomeEvent="@((id) => SomeMethod(id)" />

Now coverlet says that this line isn't tested.

In the containing control I'm testing that the delegate is called, and I have tests covering MyComponent.SomeMethod in the MyComponent.razor.cs file, but I can neither prevent Coverlet from saying this code isn't covered or find a way of excluding this line from code coverage.

Any suggestions about what I'm missing would be gratefully received.

Stuart Hemming
  • 1,553
  • 2
  • 21
  • 44
  • Suggestion - If `OnSomeEvent` returns the same pattern as `SomeMethod`, why not call `SomeMethod` directly? If not then call it through an defined intermediary method, and see what happens. – MrC aka Shaun Curtis Oct 08 '21 at 19:57
  • Just to check, arer you using bUnit ? That should be able to exercise this. – H H Oct 09 '21 at 16:19

0 Answers0