Replies: 1 comment 1 reply
-
Hey, Before we come to how it can be done, maybe it is worth asking, should you test that behavior? The next thing is that bUnit in itself isn't a whole runtime - that said bUnit doesn't have a router kickstarting the whole chain to make your lazy-loading possible in the first place. While we have something like a NavigationManager, it will not really navigate to an address as you would used to in a browser. But the router wouldn't be remotely enough to support that. Currently, bUnit doesn't know much about wasm or runtimes in general. So I am not sure if we can ever support that without adding a whole bunch of stuff to begin with. You might be better off with something like Playwright to test such behavior. If you "just" want to test your individual components, you can easily do that and render each of your lazy-loaded pages/components by itself. If I miss something obvious here (@egil) - please correct me. |
Beta Was this translation helpful? Give feedback.
-
Hey there, thanks for making bUnit! I use it in a lot of projects.
I was wondering what I'd have to do to make it possible to test my project with this.
I've build this project: https://github.com/RonSijm/RonSijm.Blazyload
Live demo: https://ronsijm.github.io/RonSijm.Blazyload/
I see there was an issue raised:
dotnet/aspnetcore#24815
I have my test kind of working - in the sense that it doesn't crash - because in the
TestServiceProvider.AddFallbackServiceProvider
I can give it a handle to my own service provider.But after going to a page that should be lazyloaded, I'm just getting "Sorry, there's nothing at this address" - so it doesn't seem like my own service provider is in charge of loading pages
I've been going though the bUnit code to see what I can implement or inject to make bUnit aware of lazy loaded dlls, but I can't really find a way to get this to work.
So I was wondering what the best approach would be, and if there are examples of bUnit working with the default LazyAssemblyLoader. I'd like to create a demo project of bUnit working together with my Blazyload project, so other people using my library can follow that example. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions