public void CopyMainStreamActivitiesWithReturnLineTest() { IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareCopyTestProcessWithReturnLineDesp(); IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp); process.Activities.FindActivityByDescriptorKey("B").CopyMainStreamActivities(process.InitialActivity, null, WfControlOperationType.Return); Assert.AreEqual(8, process.Activities.Count, "总共有8个活动,原始流程有5个活动。复制了A、B、E"); IWfActivityDescriptor copiedA = process.Activities.FindActivityByDescriptorKey("B").Descriptor.ToTransitions.GetAllForwardTransitions().First().ToActivity; Assert.AreEqual("A", copiedA.AssociatedActivityKey); Assert.AreEqual(process.InitialActivity.Descriptor.ToTransitions.Count, copiedA.ToTransitions.Count, "复制出来的A和原始的A的出线个数相同"); IWfActivityDescriptor copiedE = copiedA.ToTransitions.Find(t => t.ToActivity.AssociatedActivityKey == "E").ToActivity; IWfActivityDescriptor copiedB = copiedA.ToTransitions.Find(t => t.ToActivity.AssociatedActivityKey == "B").ToActivity; Assert.IsNotNull(copiedE.ToTransitions.First().ToActivity.Key == "C", "复制出的E指向C"); Assert.IsTrue(copiedB.ToTransitions.Exists(t => t.ToActivity.Key == "C"), "复制出的B存在指向C的线"); Assert.IsTrue(copiedB.ToTransitions.Exists(t => t.ToActivity.Key == copiedA.Key), "复制出的B存在指向复制出的A的线"); IWfActivityDescriptor actDespE = process.Activities.FindActivityByDescriptorKey("E").Descriptor; Assert.IsTrue(actDespE.ToTransitions.First().ToActivity.Key == "C", "E指向C"); IWfActivityDescriptor actDespC = process.Activities.FindActivityByDescriptorKey("C").Descriptor; Assert.IsNotNull(actDespC.ToTransitions.First().ToActivity.Key == "D", "C指向D"); }