Esempio n. 1
0
        public void ActiveMatrixResourceTest()
        {
            IWfProcessDescriptor processDesp = WfProcessTestCommon.GetDynamicProcessDesp();
            IWfProcess           process     = WfProcessTestCommon.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            Console.WriteLine(process.Activities.Count);

            ReturnExecutorTestHelper.OutputMainStream(process);
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            Assert.AreEqual(4, process.Activities.Count);
        }
Esempio n. 2
0
        public void DynamicActivityWithActivityMatrixReturnToInitialTest()
        {
            IRole role = PrepareSOARole();

            IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateSimpleProcessDescriptor();

            IWfActivityDescriptor templateActDesp = processDesp.Activities["NormalActivity"];

            FillDynamicActivitySimpleResource(templateActDesp, new WfResourceDescriptorCollection()
            {
                new WfRoleResourceDescriptor(role)
            });

            IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" }
            });

            //到第一个动态活动
            WfProcessTestCommon.MoveToNextDefaultActivityWithExecutor(process);

            process = WfRuntime.GetProcessByProcessID(process.ID);

            //到第二个动态活动
            WfProcessTestCommon.MoveToNextDefaultActivityWithExecutor(process);

            process = WfRuntime.GetProcessByProcessID(process.ID);

            //退回到起始点
            ReturnExecutorTestHelper.ExecuteReturnOperation(process.CurrentActivity, process.InitialActivity.Descriptor.Key);

            process = WfRuntime.GetProcessByProcessID(process.ID);

            Console.WriteLine(process.CurrentActivity.Descriptor.Key);
            Console.WriteLine(process.CompletedActivity.Descriptor.FromTransitions.GetAllCanTransitForwardTransitions().Count);

            ReturnExecutorTestHelper.OutputMainStream(process);
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            Assert.AreEqual(1, process.CompletedActivity.Descriptor.FromTransitions.GetAllCanTransitForwardTransitions().Count,
                            "结束点应该只有一条有效的入线s");

            Assert.AreEqual(process.InitialActivity.Descriptor.Key, process.CurrentActivity.Descriptor.AssociatedActivityKey);
        }
Esempio n. 3
0
        public void BasicDynamicActivityReturnTest()
        {
            IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateSimpleProcessDescriptor();

            IWfActivityDescriptor templateActDesp = processDesp.Activities["NormalActivity"];

            FillDynamicActivitySimpleResource(templateActDesp, (IUser)OguObjectSettings.GetConfig().Objects["approver1"].Object);

            IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp);

            ReturnExecutorTestHelper.OutputMainStream(process);

            ReturnExecutorTestHelper.OutputEveryActivities(process);

            WfProcessTestCommon.MoveToNextDefaultActivity(process);
            ReturnExecutorTestHelper.ExecuteReturnOperation(process.CurrentActivity, processDesp.InitialActivity.Key);

            //N2(Initial)->N1->N4->N5->Completed
            ReturnExecutorTestHelper.OutputMainStream(process);

            //N1->N2(Initial)->N4->N5->Completed
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            Assert.AreEqual("Initial", process.CurrentActivity.Descriptor.GetAssociatedActivity().Key);
            Assert.AreEqual(2, process.CurrentActivity.Descriptor.ToTransitions.Count);

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

            //N2(Initial)->N1->N4->N5->Completed
            ReturnExecutorTestHelper.OutputMainStream(process);

            //N1->N2(Initial)->N4->N5->Completed
            ReturnExecutorTestHelper.OutputEveryActivities(process);

            //IWfActivityDescriptor firstDynamicActDesp = ValidateDynamicActivities(process.InitialActivity.Descriptor, templateActDesp);

            //ValidateInDynamicTransitionsProperties(firstDynamicActDesp.FromTransitions, templateActDesp);

            //ValidateLastDynamicTransitions(templateActDesp);

            //ValidateTemplateCandidatesAndDynamicActivityCandidates(firstDynamicActDesp, templateActDesp);
        }