Example #1
0
        public void SimpleCopyMainStreamActivitiesTest()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareStraightProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To B
            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To C

            IWfActivity activityB = process.Activities.FindActivityByDescriptorKey("B");

            //从B复制到C
            process.Activities.FindActivityByDescriptorKey("C").CopyMainStreamActivities(activityB, null, WfControlOperationType.Return);

            process.Descriptor.Output();

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To CopiedB

            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            IWfActivityDescriptor copiedB = process.CurrentActivity.Descriptor;

            Assert.AreEqual("B", copiedB.AssociatedActivityKey);
            Assert.AreEqual("C", copiedB.ToTransitions.First().ToActivity.AssociatedActivityKey, "复制出的B指向C");
        }
Example #2
0
        public void SimpleCopyTwiceMainStreamActivitiesTest()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareStraightProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To B
            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To C

            IWfActivity activityB = process.Activities.FindActivityByDescriptorKey("B");

            //第一次
            process.Activities.FindActivityByDescriptorKey("C").CopyMainStreamActivities(activityB, null, WfControlOperationType.Return);

            Console.WriteLine("第一次");
            process.Descriptor.Output();

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //To CopiedB

            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            //第二次
            process.CurrentActivity.CopyMainStreamActivities(process.CurrentActivity, process.InitialActivity, activityB, null, WfControlOperationType.Return);

            Console.WriteLine("第二次");
            process.Descriptor.Output();

            IWfActivityDescriptor copiedA = process.CurrentActivity.Descriptor.ToTransitions.First().ToActivity;

            Assert.AreEqual("A", copiedA.AssociatedActivityKey);

            IWfActivityDescriptor copiedBAgain = copiedA.ToTransitions.First().ToActivity;

            Assert.AreEqual("B", copiedBAgain.AssociatedActivityKey, "验证第二次复制的B");

            IWfActivityDescriptor copiedC = copiedBAgain.ToTransitions.First().ToActivity;

            Assert.AreEqual("C", copiedC.AssociatedActivityKey, "验证第二次复制出的B指向第一次复制出的C");
        }