'Run .NET Tests in Production
I've just added a user management for my code, with a CurrentEnvironment.IsDevelopment() switch in the Startup class to add a simpler user management for debug purposes (if your name is "Alice", you get all the permission).
Now this works for me on my system for both running the application and tests.
However when the code gets pushed to GitLab, tests will be executed with this line:
dotnet test -c Release
And now they fail, from what I can gather because now CurrentEnvironment.IsDevelopment() returns false. However, if I run the very same command on my local machine, CurrentEnvironment.IsDevelopment() is still true, which makes debugging incredible hard.
So my question is: How do I executes my local tests with CurrentEnvironment.IsDevelopment() set to false? And just for my curiosity: why do these commands work differently for the different machines (GitLab is a mcr.microsoft.com/dotnet/sdk:6.0 docker image, my machine is Win10)?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
