programmatically detect whenever test run is in debug mode

if (System.Diagnostics.Debugger.IsAttached)
    // code or timeout value when running tests in debug mode
else

   // non debug mode

from:https://social.msdn.microsoft.com/Forums/vstudio/en-US/221c9385-e2a8-4630-b2f5-f4eabfd62df5/programmatically-detect-whenever-test-run-is-in-debug-mode?forum=vsunittest 

原文地址:https://www.cnblogs.com/94cool/p/9198756.html