C#C
C#12mo ago
surwren

✅ Structuring Unit Tests

I am following the sample from (https://learn.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-9.0) namely (https://github.com/dotnet/AspNetCore.Docs.Samples/tree/main/test/integration-tests/8.x/IntegrationTestsSample)

I have loaded all.csproj files in MSVS with right click -> add, then did Test -> Run All Tests

The tests run successfully, but I am confused about whether it is necessary to structure my own unit tests this way (folderwise?)

It seems there are 3 .csproj files altogether
  • RazorPagesProject.csproj
  • RazorPagesProject.Tests.csproj
  • RazorPagesProject.Tests.csproj (separate folder)
Do I need to use a separate folder for the tests? Why are there 2 versions of RazorPagesProject.Tests.csproj?
image.png
image.png
Was this page helpful?