C
C#2d 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?
No description
No description
8 Replies
Pobiega
Pobiega2d ago
Looking at the repo you referenced, there are only two csproj files
.
├── src/
│ └── RazorPagesProject/
│ └── RazorPagesProject.csproj
└── tests/
└── RazorPagesProject.Tests/
└── RazorPagesProject.Tests.csproj
.
├── src/
│ └── RazorPagesProject/
│ └── RazorPagesProject.csproj
└── tests/
└── RazorPagesProject.Tests/
└── RazorPagesProject.Tests.csproj
this is the standard structure and I suggest you try and follow it where possible, yes
surwren
surwrenOP2d ago
There are three
No description
No description
Pobiega
Pobiega2d ago
No there isnt
Pobiega
Pobiega2d ago
No description
Pobiega
Pobiega2d ago
did you clone that repo?
surwren
surwrenOP2d ago
Oh they must have updated it since writing the docs
surwren
surwrenOP2d ago
I followed this direct download from the Documentations page
No description
Unknown User
Unknown User2d ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?