Beispiel #1
0
        public void CopyMainStreamActivitiesTest()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareCopyTestProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            process.Activities.FindActivityByDescriptorKey("B").CopyMainStreamActivities(process.InitialActivity, null, WfControlOperationType.Return);

            Assert.AreEqual(8, process.Activities.Count, "总共有8个活动");
            IWfActivityDescriptor copiedA = process.Activities.FindActivityByDescriptorKey("B").Descriptor.ToTransitions.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.IsTrue(copiedE.ToTransitions.First().ToActivity.Key == "C", "复制出的E指向C");
            Assert.IsTrue(copiedB.ToTransitions.First().ToActivity.Key == "C", "复制出的B指向C");

            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");
        }
Beispiel #2
0
        public void MoveToCopiedMainStreamActivitiesTest()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareCopyTestProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            process.Activities.FindActivityByDescriptorKey("B").CopyMainStreamActivities(process.InitialActivity, null, WfControlOperationType.Return);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To B
            Assert.AreEqual("B", process.CurrentActivity.Descriptor.Key);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To A1
            Assert.AreEqual("A", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To B1
            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To C
            Assert.AreEqual("C", process.CurrentActivity.Descriptor.Key);
        }