Skip to content

The invocation of 'render' with the argument [Microsoft.AspNetCore.Components.ElementReference] was not expected. #235

Answered by egil
Naganathan asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @Naganathan

I have a few comments on your sample:

  1. Use beta-10 or later of bUnit if you are targeting .net5. Otherwise you have to use netcoreapp3.1.
  2. When calling the invokeasync on jsinterop, just pass the parameters directly, not through an array, e.g.: await jsRuntime.InvokeAsync<bool>("render", element);
  3. When you are using NUnit, dont both inherit from Bunit.TestContext and instantiate a TestContext like you are. Add the suggestion base class as shown here, and just use that: https://bunit.egilhansen.com/docs/getting-started/writing-csharp-tests.html?tabs=nunit#remove-boilerplate-code-from-tests
  4. If you do not need to verify that a reference to a particular element was passed, you …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by egil
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
Converted from issue

This discussion was converted from issue #235 on October 22, 2020 21:33.