Example #1
0
        public void ReturnExecutorTestReplay()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver1, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivityWithDefSelectTranstion(OguObject.approver2, process);

            //退件到初始活动
            process = WfRuntime.GetProcessByProcessID(process.ID);
            WfReturnExecutor returnExec = new WfReturnExecutor(process.CurrentActivity, process.Activities[0]);

            returnExec.Execute();

            Assert.IsTrue(process.CurrentActivity.CreatorInstanceID != "");
            Assert.IsTrue(ProcessTestHelper.ExistsActivityUserTasks(process.CurrentActivity.ID, TaskStatus.Ban));

            process = WfRuntime.GetProcessByProcessID(process.ID);
            IWfActivity act = process.Activities.FindActivityByDescriptorKey(process.CurrentActivity.Descriptor.AssociatedActivityKey);

            Assert.AreEqual(act.Assignees.Count, process.CurrentActivity.Assignees.Count);

            Assert.AreEqual(process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity.AssociatedActivityKey, act.Descriptor.ToTransitions[0].ToActivity.Key);
            Assert.IsTrue(process.Activities.FindActivityByDescriptorKey(process.CurrentActivity.Descriptor.ToTransitions[0].ToActivity.Key).Assignees.Count > 0);
        }
Example #2
0
        public void ReturnExecutorTest()
        {
            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);
            WfReturnExecutor returnExec = new WfReturnExecutor(process.CurrentActivity, process.Activities[1]);

            returnExec.Execute();

            process = WfRuntime.GetProcessByProcessID(process.ID);
            Assert.IsTrue(process.CurrentActivity.CreatorInstanceID != "");
            Assert.AreEqual(process.ElapsedActivities[process.ElapsedActivities.Count - 1].ID, process.CurrentActivity.CreatorInstanceID);

            WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities();

            Assert.AreEqual(6, coll.Count);
            Assert.IsTrue(ProcessTestHelper.ExistsActivityUserTasks(process.CurrentActivity.ID, TaskStatus.Ban));
        }