Пример #1
0
        public void ActivityMatrixWithNotifierTest()
        {
            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp(resource);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);

            Assert.AreEqual(5, process.Activities.Count);

            Assert.IsTrue(process.Descriptor.Activities["ND10"].EnterEventReceivers.Count > 0);
            Assert.IsTrue(process.Descriptor.Activities["ND20"].EnterEventReceivers.Count > 0);

            Assert.IsTrue(process.Descriptor.Activities["ND10"].LeaveEventReceivers.Count > 0);
            Assert.IsTrue(process.Descriptor.Activities["ND20"].LeaveEventReceivers.Count > 0);
        }
Пример #2
0
        public void ActivityMatrixRowOperatorsCountTest()
        {
            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp();
            IWfProcess           process     = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);

            Assert.AreEqual(5, process.Activities.Count);
        }
Пример #3
0
        public void SameActivitySNActivityMatrixTest()
        {
            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareSameSNActivityMatrixResourceDescriptor();
            IWfProcessDescriptor processDesp            = ProcessHelper.GetDynamicProcessDesp(resource, string.Empty);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);

            Assert.AreEqual(4, process.Activities.Count);
        }
Пример #4
0
        public void ActivityMatrixWithDynamicActivityTest()
        {
            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareDynamicActivityMatrixResourceDescriptor();
            IWfProcessDescriptor processDesp            = ProcessHelper.GetDynamicProcessDesp(resource, string.Empty);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 },
                { "ReportLine", new IUser[] { OguObjectSettings.GetConfig().Objects["approver1"].User, OguObjectSettings.GetConfig().Objects["cfo"].User } }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);

            Assert.AreEqual(7, process.Activities.Count);
        }
Пример #5
0
        public void MergeMatchedActivityMatrixAndApprovalMatrixProcessTest()
        {
            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            WfApprovalMatrixAdapter.Instance.Update(approvalMatrix);

            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp(approvalMatrix.ID);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);

            Assert.AreEqual(6, process.Activities.Count);
        }
Пример #6
0
        public void MergeNotMatchedActivityMatrixAndApprovalMatrixProcessTest()
        {
            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            WfApprovalMatrixAdapter.Instance.Update(approvalMatrix);

            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareActivityMatrixResourceDescriptor();

            resource.Rows.ForEach(row => row.Values.FindByColumnName(SOARolePropertyDefinition.ActivityCodeColumn).Value = "NotMatched");

            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp(resource, approvalMatrix.ID);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);

            process.Activities.ForEach(act =>
            {
                if (act.Descriptor.ActivityType == WfActivityType.NormalActivity)
                {
                    if (act.Descriptor.Properties.GetValue("IsDynamic", false) == false)
                    {
                        Console.WriteLine(act.Descriptor.Name);
                        Assert.IsTrue(act.Descriptor.Name.IndexOf("审批") >= 0);
                    }
                }
            });

            Assert.AreEqual(8, process.Activities.Count);
        }
Пример #7
0
        public void MergeActivityMatrixWithDynamicActivityAndApprovalMatrixTest()
        {
            WfActivityMatrixResourceDescriptor resource = ActivityMatrixHelper.PrepareDynamicActivityMatrixResourceDescriptor();

            WfApprovalMatrix approvalMatrix = ApprovalMatrixHelper.PrepareApprovalMatrix();

            WfApprovalMatrixAdapter.Instance.Update(approvalMatrix);

            IWfProcessDescriptor processDesp = ProcessHelper.GetDynamicProcessDesp(resource, approvalMatrix.ID);

            IWfProcess process = ProcessHelper.StartupProcess(processDesp, new Dictionary <string, object>()
            {
                { "CostCenter", "1001" },
                { "PayMethod", "1" },
                { "Age", 30 },
                { "ReportLine", new IUser[] { OguObjectSettings.GetConfig().Objects["approver1"].User, OguObjectSettings.GetConfig().Objects["cfo"].User } }
            });

            Console.WriteLine(process.Activities.Count);

            WfOutputHelper.OutputMainStream(process);
            WfOutputHelper.OutputEveryActivities(process);
        }