Exemple #1
0
        public void ExpenseProcessSerializationTest()
        {
            IWfProcessDescriptor processDesp = WfProcessTestCommon.LoadProcessDescriptorFromFile("Expense.xml");

            IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp);

            process.ApplicationRuntimeParameters["Amount"] = 500;

            WfRuntime.PersistWorkflows();

            process = WfRuntime.GetProcessByProcessID(process.ID);

            WfProcessTestCommon.MoveToNextDefaultActivityWithExecutor(process);

            process = WfRuntime.GetProcessByProcessID(process.ID);

            IWfActivityDescriptor currentActDesp = process.CurrentActivity.Descriptor;

            ToTransitionsDescriptorCollection transitions = currentActDesp.ToTransitions;

            foreach (string key in transitions.GetAllKeys())
            {
                Assert.IsTrue(key.IsNotEmpty());

                IWfTransitionDescriptor transition = transitions[key];

                Assert.AreEqual(key, transition.Key);
            }
        }
Exemple #2
0
        public void BranchProcessContainsSecretaryWithAgreeLineTest()
        {
            IWfProcessDescriptor processDesp = WfProcessTestCommon.CreateBranchProcessWithSecretaryAndAgreeLine();

            IWfProcess process = WfProcessTestCommon.StartupProcess(processDesp);

            WfProcessTestCommon.MoveToNextDefaultActivityWithExecutor(process);

            process = WfRuntime.GetProcessByProcessID(process.ID);

            process.CurrentActivity.BranchProcessGroups[0].Branches.ForEach(subProcess =>
            {
                Console.WriteLine("分支流程ID={0}", subProcess.ID);
                OutputProcessCandidatesAndOutTransitions(subProcess);
            });
        }
Exemple #3
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);
        }