Пример #1
0
        public void DispatchWithdrawProcessTaskTest()
        {
            IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateSimpleProcessDescriptorWithBranchTemplate();

            IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp);

            MoveToExecutor(process);

            SysTaskAdapter.Instance.ClearAll();

            DispatchWithdrawProcessTask withdrawTask = DispatchWithdrawProcessTask.SendTask(string.Empty, process.ID, true);

            //直接发布一个撤回的任务流程
            SysTaskCommon.ExecuteAndAssertTask(withdrawTask);

            int executedTaskCount = SysTaskCommon.ExecuteAllTasks();

            WfRuntime.ClearCache();
            process = WfRuntime.GetProcessByProcessID(process.ID);

            Assert.AreEqual(WfProcessStatus.Running, process.Status);
            Assert.AreEqual(WfActivityType.InitialActivity, process.CurrentActivity.Descriptor.ActivityType);

            AssertAllBranchesStatus(WfProcessStatus.Aborted, process);
        }
        protected override void OnSaveApplicationData(WfExecutorDataContext dataContext)
        {
            DispatchWithdrawProcessTask.SendTask(string.Empty, this.Process.ID, true);

            base.OnSaveApplicationData(dataContext);
        }