private static void CheckIfExistDifferentRunner(TestflowRunnerOptions options) { if (null != _runnerInst && !_runnerInst.Option.Equals(options)) { throw new TestflowRuntimeException(-1, "A flowrunner instance with different option exist."); } }
/// <summary> /// 抽象类的构造方法 /// </summary> /// <param name="options"></param> protected TestflowRunner(TestflowRunnerOptions options) { this.Option = options; this.Context = new TestflowContext(); I18NOption i18NOption = new I18NOption(typeof(TestflowRunner).Assembly, "i18n_common_cn", "i18n_common_en") { Name = CommonConst.I18nName }; I18N i18N = I18N.GetInstance(i18NOption); }
/// <summary> /// 获取或创建当前AppDomain下的FlowRunner实例 /// </summary> /// <param name="options">FlowRunner的选项配置</param> /// <returns></returns> public static TestflowRunner GetInstance(TestflowRunnerOptions options) { CheckIfExistDifferentRunner(options); if (null != _runnerInst) { return(_runnerInst); } lock (_instLock) { Thread.MemoryBarrier(); CheckIfExistDifferentRunner(options); if (null != _runnerInst) { _runnerInst = GenerateFlowRunner(options); } } return(_runnerInst); }
private static TestflowRunner GenerateFlowRunner(TestflowRunnerOptions options) { throw new System.NotImplementedException(); }