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

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

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

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

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

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

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