Skip to content

Blazor Syncfusion Testing with BUnit #1372

Answered by linkdotnet
BenPughyy asked this question in Q&A
Discussion options

You must be logged in to vote

Hey.

When we are speaking in the context of unit testing, you might want to extract SyncFusion (or any 3rd party library) out of the equation. The problem is that it makes your test brittle. As the SfTooltip doesn't expose an easy way of triggering the "open" part, you might want to resort to checking whether or not your component probably sets the ChildContent. The opening part itself is not part of your logic but the ones of SfTooltip. Your test should pass/fail independent of the implementation details of SyncFusions components.

That said, you can simply retrieve the ChildContent from the instance:

var cut = testContext.RenderComponent<SimpleTooltip>(/*Some setup code*/);
var childContent

Replies: 1 comment 1 reply

Comment options

linkdotnet
Feb 9, 2024
Maintainer Sponsor

You must be logged in to vote
1 reply
@BenPughyy
Comment options

Answer selected by BenPughyy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants