public void MainStreamActivitiesWithConsignActivity() { IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee(); //会签 string currentActivityID = process.CurrentActivity.ID; WfActivityDescriptor actDesp = AddActivity(process); WfTransferParams tp = new WfTransferParams(actDesp); IUser user = (IUser)OguObjectSettings.GetConfig().Objects[OguObject.requestor.ToString()].Object; tp.Assignees.Add(user); tp.BranchTransferParams.Add(new WfBranchProcessTransferParams( ProcessTestHelper.CreateConsignTemplate(WfBranchProcessExecuteSequence.Parallel, WfBranchProcessBlockingType.WaitAllBranchProcessesComplete), new IUser[] { (IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object, (IUser)OguObjectSettings.GetConfig().Objects["approver2"].Object })); process.MoveTo(tp); WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities(); Assert.AreEqual(process.Activities.Count - 1, coll.Count); }
public void MainStreamActivitiesWithReturn() { IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee(); ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process); process = WfRuntime.GetProcessByProcessID(process.ID); ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process); process = WfRuntime.GetProcessByProcessID(process.ID); ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process); process = WfRuntime.GetProcessByProcessID(process.ID); int i = process.Activities.Count; Assert.AreEqual(6, i); Assert.AreEqual(6, process.Descriptor.Activities.Count); WfRuntime.ProcessContext.ActivityChangingContext.CreatorInstanceID = process.CurrentActivity.ID; process.CurrentActivity.CopyMainStreamActivities(process.Activities[1], null, WfControlOperationType.Return); int j = process.Activities.Count; Assert.AreEqual(9, j); Assert.AreEqual(9, process.Descriptor.Activities.Count); //此时还在当前节点,如果流转,也是流转到process.Activities[1]中 ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.requestor, process); process = WfRuntime.GetProcessByProcessID(process.ID); Assert.IsTrue(process.CurrentActivity.CreatorInstanceID.IsNotEmpty()); Assert.AreEqual(process.ElapsedActivities[process.ElapsedActivities.Count - 1].ID, process.CurrentActivity.CreatorInstanceID); WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities(); Assert.AreEqual(6, coll.Count); }
public void MainStreamActivitiesWithDynamicActivity() { IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee(); string currentActivityID = process.CurrentActivity.ID; //新增点 WfActivityDescriptor actDesp = AddActivity(process); WfTransferParams tp = new WfTransferParams(actDesp); IUser user = (IUser)OguObjectSettings.GetConfig().Objects[OguObject.requestor.ToString()].Object; tp.Assignees.Add(user); process.MoveTo(tp); ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.approver2, process); WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities(); Assert.AreEqual(6, coll.Count, "动态创建的点不在主流程里头"); Assert.AreEqual(7, process.Activities.Count, "流程中有7个点,其中一个是动态创建的点"); Assert.AreEqual(process.Activities[0].Descriptor.ToTransitions[0].ToActivity.Key, actDesp.Key); Assert.AreEqual(actDesp.ToTransitions[0].ToActivity.Key, process.CurrentActivity.Descriptor.Key); }