Closed maldworth closed 4 years ago
Do you think RazorLight should utilize ASP.NET Integration Testing? If so, why? My point being, that integration testing stuff is meant to integrate an ASP.NET host without running kestrel or IIS. You are likely not using RazorLight with either Kestrel or IIS, so why are you trying to use Integration Testing framework meant to solve those problems.
@maldworth So what you propose to be a default behavior?
2 options:
var assembly = operatingAssembly ?? Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
, then hopefully nobody encounters this again.I'll let the package maintainers/contributors decide what you prefer.
But can't you just call SetOperatingAssembly? I'm not trying to be critical of using ASP.NET Integration Testing framework, but for my tastes its a lot of machinery to test RazorLight. If you do find value in it, I am curious what it is so I can learn.
If you CAN call SetOperatingAssembly, AND there is value to ASP.NET Integration Testing being used, then IMHO the right approach is to update the README with guidance on doing so. Does that make sensE?
Yes, I did call SetOperatingAssembly, works as expected. Correct, one doesn't need TestHost to test RazorLight specifically. Sounds like option 1 is the best choice here. Thanks for the quick responses!
When using the TestHost for asp.net core (WebApplicationFactory)
This line in the RazorLightEngineBuilder gives null.
I had to Set the operating assembly to use Assembly.GetExecutingAssembly(). GetEntryAssembly() works the rest of the time (running the api normally, not using the TestHost).