//true则为单元测试环境下,false不是 bool unitTest = System.Environment.StackTrace.IndexOf("NUnit.Framework", StringComparison.CurrentCultureIgnoreCase) >= 0;