using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace wcftest.BussinessExtension { public class VirtualModeHelper { /// /// 模拟环境下抛出异常 /// /// public static void ThrowExceptionWhenVirtualMode(bool IsVirtualMode) { if (IsVirtualMode) { //模拟环境下,认为抛出异常 //在测试环境下,你可以屏蔽该代码 //发布到生产环境,请打开该代码 //throw new Exception("此次是模拟环境!警告"); } } } }