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");
        }
        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);
        }
        public void AgreeReturnTwiceThenWithdrawTest()
        {
            IWfActivity activityB = ReturnExecutorTestHelper.PrepareAndMoveToAgreeSelectorActivity();

            Assert.AreEqual("B", activityB.Descriptor.Key);

            SetToLineAndMSLineSelected(activityB, "C", false);
            SetToLineAndMSLineSelected(activityB, "A", true);

            Console.WriteLine("退回之前");
            Console.WriteLine("当前活动{0}", activityB.Process.CurrentActivity.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities((activityB.Process));

            MoveAgreeProcessOneStepAndValidate(activityB.Process, 1);

            WfProcessTestCommon.MoveToNextDefaultActivity(activityB.Process);   //To N2(B)

            Console.WriteLine("第二次退回之前");
            Console.WriteLine("当前活动{0}", activityB.Process.CurrentActivity.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities((activityB.Process));

            Assert.AreEqual("N2", activityB.Process.CurrentActivity.Descriptor.Key);

            MoveAgreeProcessOneStepAndValidate(activityB.Process, 2);

            Console.WriteLine("第二次退回之后");
            Console.WriteLine("当前活动{0}", activityB.Process.CurrentActivity.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityB.Process);

            Assert.AreEqual("N3", activityB.Process.CurrentActivity.Descriptor.Key);
        }
        public void AgreeReturnTwiceTest()
        {
            IWfActivity activityB = ReturnExecutorTestHelper.PrepareAndMoveToAgreeSelectorActivity();

            Assert.AreEqual("B", activityB.Descriptor.Key);

            SetToLineAndMSLineSelected(activityB, "C", false);
            SetToLineAndMSLineSelected(activityB, "A", true);

            Console.WriteLine("第一次退回之前,不同意");
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityB.Process);

            MoveAgreeProcessAndValidate(activityB.Process, 1);

            Console.WriteLine("第二次退回之前,同意");
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityB.Process);

            MoveAgreeProcessAndValidate(activityB.Process, 2);

            Console.WriteLine("第二次退回之后,同意");
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityB.Process);

            ReturnExecutorTestHelper.ValidateMainStreamActivities(activityB.Process, "A", "B", "C", "D", "F");
        }
        public void ReturnTwiceTest()
        {
            IWfActivity activityD = ReturnExecutorTestHelper.PrepareAndMoveToSpecialActivity();

            Assert.AreEqual("D", activityD.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            //第一次退回
            ReturnExecutorTestHelper.ExecuteReturnOperation(activityD, "A");

            Console.WriteLine("第一次退回后");
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            WfProcessTestCommon.MoveToNextDefaultActivity(activityD.Process);   //B1
            WfProcessTestCommon.MoveToNextDefaultActivity(activityD.Process);   //C1
            WfProcessTestCommon.MoveToNextDefaultActivity(activityD.Process);   //D1

            Assert.AreEqual("D", activityD.Process.CurrentActivity.Descriptor.AssociatedActivityKey);

            //在B的出线C和E之间选择E
            activityD.Process.ApplicationRuntimeParameters["IsCLine"] = false;

            //第二次退回
            ReturnExecutorTestHelper.ExecuteReturnOperation(activityD, "A");

            Console.WriteLine("第二次退回后");
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            ReturnExecutorTestHelper.ValidateMainStreamActivities(activityD.Process, "A", "B", "E", "D", "F");
        }
        public void AgreeReturnOnceThenWithdrawTest()
        {
            IWfActivity activityB = ReturnExecutorTestHelper.PrepareAndMoveToAgreeSelectorActivity();

            Assert.AreEqual("B", activityB.Descriptor.Key);

            SetToLineAndMSLineSelected(activityB, "C", false);
            SetToLineAndMSLineSelected(activityB, "A", true);

            Console.WriteLine("退回之前");
            Console.WriteLine("当前活动{0}", activityB.Process.CurrentActivity.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities((activityB.Process));

            MoveAgreeProcessOneStepAndValidate(activityB.Process, 1);

            Console.WriteLine("撤回之前");
            Console.WriteLine("当前活动{0}", activityB.Process.CurrentActivity.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityB.Process);
            ReturnExecutorTestHelper.OutputEveryActivities((activityB.Process));

            IWfProcess process = DoWithdrawExecutor(activityB.Process);

            activityB.Process.Descriptor.Output();

            Console.WriteLine("撤回之后");
            Console.WriteLine("当前活动{0}", process.CurrentActivity.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(process);
            ReturnExecutorTestHelper.OutputEveryActivities(process);
            activityB.Process.Descriptor.Output();

            //activityB.Process.Descriptor.Output();

            //ReturnExecutorTestHelper.ValidateMainStreamActivities(activityB.Process, "A", "B", "C", "D", "F");
        }
        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");
        }
        public void ReturnOnceThenWithdrawTest()
        {
            IWfActivity activityD = ReturnExecutorTestHelper.PrepareAndMoveToSpecialActivity();

            int originalActivityCount = activityD.Process.Activities.Count;

            Assert.AreEqual("D", activityD.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            ReturnExecutorTestHelper.ExecuteReturnOperation(activityD, "A");

            Console.WriteLine("退件之后");
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            IWfProcess process = DoWithdrawExecutor(activityD.Process);

            Console.WriteLine("撤回之后");
            ReturnExecutorTestHelper.OutputMainStream(process);
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            Assert.AreEqual(originalActivityCount, process.Activities.Count, "撤回后与退件前的活动数一样");
            Assert.AreEqual(originalActivityCount, process.Descriptor.Activities.Count, "撤回后与退件前的活动数一样");
        }
Exemple #9
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);
        }
Exemple #10
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);
        }
        public void ReturnTwiceThenWithdrawTwiceTest()
        {
            IWfActivity activityD = ReturnExecutorTestHelper.PrepareAndMoveToSpecialActivity();

            int originalActivityCount = activityD.Process.Activities.Count;

            Assert.AreEqual("D", activityD.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            //第一次退回
            ReturnExecutorTestHelper.ExecuteReturnOperation(activityD, "A");

            Console.WriteLine("第一次退回后");
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            WfProcessTestCommon.MoveToNextDefaultActivity(activityD.Process);   //B1
            WfProcessTestCommon.MoveToNextDefaultActivity(activityD.Process);   //C1
            WfProcessTestCommon.MoveToNextDefaultActivity(activityD.Process);   //D1

            Assert.AreEqual("D", activityD.Process.CurrentActivity.Descriptor.AssociatedActivityKey);

            //在B的出线C和E之间选择E
            activityD.Process.ApplicationRuntimeParameters["IsCLine"] = false;

            //第二次退回
            ReturnExecutorTestHelper.ExecuteReturnOperation(activityD, "A");

            Console.WriteLine("第二次退回后");
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            IWfProcess process = process = DoWithdrawExecutor(activityD.Process);

            Console.WriteLine("第一组撤回之后");
            ReturnExecutorTestHelper.OutputMainStream(process);
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            process = DoWithdrawExecutor(activityD.Process);    //C1;
            process = DoWithdrawExecutor(activityD.Process);    //B1
            process = DoWithdrawExecutor(activityD.Process);    //A1

            process = DoWithdrawExecutor(activityD.Process);

            Console.WriteLine("第二组撤回之后");
            ReturnExecutorTestHelper.OutputMainStream(process);
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            Assert.AreEqual(originalActivityCount, process.Activities.Count, "撤回后与退件前的活动数一样");
            Assert.AreEqual(originalActivityCount, process.Descriptor.Activities.Count, "撤回后与退件前的活动数一样");
        }
        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);
        }
        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");
        }
        public void ReturnOnceTest()
        {
            IWfActivity activityD = ReturnExecutorTestHelper.PrepareAndMoveToSpecialActivity();

            Assert.AreEqual("D", activityD.Descriptor.Key);
            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            ReturnExecutorTestHelper.ValidateMainStreamActivities(activityD.Process, "A", "B", "C", "D", "F");

            ReturnExecutorTestHelper.ExecuteReturnOperation(activityD, "A");

            IWfActivity returnedActivity = activityD.Process.CurrentActivity;

            Assert.AreEqual("A", returnedActivity.Descriptor.AssociatedActivityKey);
            Assert.AreEqual(activityD.ID, returnedActivity.CreatorInstanceID);
            ReturnExecutorTestHelper.ValidateBRelativeActivityOutTransitions(activityD.Process.CurrentActivity);

            ReturnExecutorTestHelper.OutputMainStream(activityD.Process);
            ReturnExecutorTestHelper.OutputEveryActivities(activityD.Process);

            ReturnExecutorTestHelper.ValidateMainStreamActivities(activityD.Process, "A", "B", "C", "D", "F");
        }