Closed thomasrea0113 closed 4 years ago
Just to be sure, I created a separate project with a simple Core web app, and was able to use WebApplicationFactory no problem, so I feel reasonably confident that the issue is that the tests and app are in the same project. I REALLY don't want to have to split them out. I find it so much neater to have Controllers.HomeController.cs
and Controllers.HomeController.Tests.cs
files, where the *.Tests.cs contain a test class called Controllers.Tests.HomeControllerTests
is anyone aware of a workaround for this? I know this isn't really standard dotnet practice, but I find it so much easier to have everything in one project (similar to how the JS libraries and Django handle it).
Hi. Thanks for contacting us. We're closing this issue as there was not much community interest in this ask for quite a while now. You can learn more about our triage process and how we handle issues by reading our Triage Process writeup.
Describe the bug
When Using along site XUnit and
<IClassFixture>
this exception is always thrown when accessing any of the factories properties. I have added all the tests to*.Tests.cs
files in the same project, and exclude them from the build when the configuration is Release:To Reproduce
Test Class
This works quite well without the
_factory.Server
call, and I much prefer this project layout. However, I always receive this exception with that call:TestWebApplicationFactory
extendsWebApplicationFactory
. I also tried overridingCreateHostBuilder
with the following:but then the same exception is thrown on the call to
UseSolutionRelativeContentRoot
Further technical details
dotnet info