how to tell in code if we are running from a testmethod .net test
- by fearofawhackplanet
Is there a way to know when code is being called from running a test method?
bool MyMethod()
{
if ( /* are we running a test? */ )
{
return true; // otherwise this will fail from the automated build script
}
else
{
// run the proper code
}
}
and please spare me the "this is a really bad idea" comments :)