According to the BUnit documentation this should be available by default.
But in my Unit test Microsoft.JSInterop is a namespace, not a class where Setup can be called on. I've also tried BUnitJSInterop. Am I missing a using? Or something else?
Maybe I need to be in a test context? I'm already writing this code from an XUnit [Fact] attributed method. I don't think BUnit has any context modifiers.
The
BunitJSInteroptype is member of theTestContext, see our API documentation.That said you can easily access the property like this:
Your issue might arise as your class is not directly inheriting from
TestContextbut is newed up in your test: