I've web Api build it .NET 5.0.
Web API structure:
- Main Web Project (Contains controllers and other client specific data)
- Infrastructure Project (It has services and repositories with more business logic)
- Models (Db entities)
- Tests (Test cases written in Xunit)
- I have also added XUnit.Coverlet.Collector and XUnit.Coverlet.MSBuild projects too.
The issue:
I'm not sure how to guide coverlet to use existing tests which are written in Tests project to the controller of main app.
For now I have just created one controller in web api and their tests in both collector and msbuild project. this is working fine, I can generate code coverage for this controller i.e. PrimeController.cs (and then there are other classes and controllers with no coverage in reports.)
If I follow this working process, I've to copy all tests twice in both projects.
Isn't there any way I can just give a reference of my Tests project to msBuild and Collector?
Any help would be really appreciated.