I have two projects. One is an ASP.NET Core 3.1 project with the following structure.
MyApp.Web
wwwroot
(css, js folders etc.)
Resources
(production files)
I also have an integration test project.
MyApp.Web.IntegrationTests
Resources
(test files)
The integration test project contains a test class that extends IClassFixture<WebApplicationFactory<MyApp.Web.Startup>>
and has its own Resources
folder containing test files.
I would like to keep my test files in the integration test project, and for my web app to reference the integration test Resources
folder when running integration tests. Of course, when running the web app normally, the web app should reference its own Resources
folder.
What's the best way to achieve this?
Apologies, this is too long for a comment...
Take a look at https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1
In particular mocking and path inference using WebApplicationFactoryContentRootAttribute