I know I can do this when I run test via command line :
dotnet test myproject.csproj /p:IsTest=true
What if I want to pass that /p:IsTest=true
when I run test via Visual studio's Test Explorer? How can I do this?
The Goal:
What I want to do is, selectively excluded some portion of my code from build process only when I want to run Test
in myproject.csproj :
<PropertyGroup>
...
<DefineConstants Condition=" '$(IsTest)' == 'true' ">$(DefineConstants);TEST</DefineConstants>
</PropertyGroup>
This will allow me to put any codes behind #if TEST ... #endif
or #if !TEST ... #endif
So I want to know if I can apply this concept when I run test from the Visual Studio itself rather than run test in cmd myself.