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 AddApproverReturnTest()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareAddApproverReturnProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);

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

            WfAddApproverExecutor executor = new WfAddApproverExecutor(process.CurrentActivity, process.CurrentActivity);

            executor.Assignees.Add((IUser)OguObjectSettings.GetConfig().Objects["requestor"].Object);

            executor.ExecuteNotPersist();

            Assert.AreEqual(6, process.Activities.Count, "加签后变成6个活动");

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //B的衍生点
            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //C的衍生点
            Assert.AreEqual("C", process.CurrentActivity.Descriptor.Key);

            ReturnExecutorTestHelper.ExecuteReturnOperation(process.CurrentActivity, "B");

            Assert.AreEqual(8, process.Activities.Count, "退回后8个活动");
            Assert.AreEqual("B", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //C的衍生点
            Assert.AreEqual("C", process.CurrentActivity.Descriptor.AssociatedActivityKey);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);     //D
            Assert.AreEqual("D", process.CurrentActivity.Descriptor.Key);
        }
Beispiel #3
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");
        }
Beispiel #4
0
        /// <summary>
        /// 准备同意/不同意流程,流转到到选择同意/不同意的活动(B)
        /// </summary>
        /// <returns></returns>
        public static IWfActivity PrepareAndMoveToAgreeSelectorActivity()
        {
            //准备同意/不同意的退回流程。在B环节有两根出线BC和BA,BA是退回线,退回到A。其中BA默认是没有选择的
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareAgreeReturnProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);             //To B

            return(process.CurrentActivity);
        }
Beispiel #5
0
        /// <summary>
        /// 准备流程,然后流转到活动D
        /// </summary>
        /// <returns></returns>
        public static IWfActivity PrepareAndMoveToSpecialActivity()
        {
            IWfProcessDescriptor processDesp = ReturnExecutorTestHelper.PrepareSpecialReturnProcessDesp();

            IWfProcess process = ReturnExecutorTestHelper.StartSpecialReturnProcess(processDesp);

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

            return(process.CurrentActivity);
        }
Beispiel #6
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);
        }
Beispiel #7
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");
        }