You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Using libraries like AutoMocker as fallback provider
84
+
It is possible to use libraries that automatically create mock services as fallback service providers. Here is an example implementation that utilizes the AutoMocker
Copy file name to clipboardExpand all lines: docs/site/docs/test-doubles/emulating-ijsruntime.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,13 @@ var moduleInterop = JSInterop.SetupModule("hello.js");
88
88
moduleInterop.SetupVoid("world");
89
89
```
90
90
91
+
When testing methods that return an `IJSObjectReference`, such as `await JsRuntime.InvokeAsync<IJSObjectReference>("SomeModule.GetInstance")`, the same process can be used with the identifier associated with the interoperation, configuring the `IJSObjectReference` in the same manner as a module.
By default, a module Interop inherits the `Mode` setting from the root JSInterop in bUnit. However, you can override it explicitly and have it in a different mode from another module's Interop or the root JSInterop. Just set the `Mode` property, e.g.:
0 commit comments