Beispiel #1
0
        public void WfAclAdapterDataTest()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            ((WfProcess)process).ResourceID = "resource2";

            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.approver2, process);

            string userId = process.CurrentActivity.Assignees[0].User.ID;

            WfAclItemCollection itemColl = WfAclAdapter.Instance.Load(builder =>
            {
                builder.AppendItem("RESOURCE_ID", "resource2");
                builder.AppendItem("OBJECT_ID", userId);
            });

            Assert.AreEqual(1, itemColl.Count, "相同的人只保留一条记录");

            WfAclItemCollection coll = WfAclAdapter.Instance.LoadByResourceID("resource2");

            Assert.AreEqual(2, coll.Count, "只会有两条记录.在一个资源下同一个人只会有一条记录存在.但是如果存在委托时,则个数就不定");

            foreach (WfAclItem data in coll)
            {
                WfAclAdapter.Instance.Delete(data);
            }
        }
Beispiel #2
0
        public void LoadProcessByActivityIDTest()
        {
            string     actId   = string.Empty;
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            ((WfProcess)process).ResourceID = "resource2";

            actId = process.CurrentActivity.ID;
            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.requestor, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.approver2, process);

            process = WfRuntime.GetProcessByProcessID(process.ID);
            IWfProcess proc = WfRuntime.GetProcessByActivityID(actId);

            Assert.AreEqual(process.ID, proc.ID);
            Assert.AreEqual(process.CurrentActivity.ID, proc.CurrentActivity.ID);
        }
Beispiel #3
0
        public void MainStreamActivitiesWithDynamicActivity()
        {
            IWfProcess process = WfProcessTestCommon.StartupProcessWithAssignee();

            string currentActivityID = process.CurrentActivity.ID;
            //新增点
            WfActivityDescriptor actDesp = AddActivity(process);

            WfTransferParams tp   = new WfTransferParams(actDesp);
            IUser            user = (IUser)OguObjectSettings.GetConfig().Objects[OguObject.requestor.ToString()].Object;

            tp.Assignees.Add(user);

            process.MoveTo(tp);

            ProcessTestHelper.MoveToAndSaveNextActivity(OguObject.approver2, process);

            WfMainStreamActivityDescriptorCollection coll = process.Descriptor.GetMainStreamActivities();

            Assert.AreEqual(6, coll.Count, "动态创建的点不在主流程里头");
            Assert.AreEqual(7, process.Activities.Count, "流程中有7个点,其中一个是动态创建的点");
            Assert.AreEqual(process.Activities[0].Descriptor.ToTransitions[0].ToActivity.Key, actDesp.Key);
            Assert.AreEqual(actDesp.ToTransitions[0].ToActivity.Key, process.CurrentActivity.Descriptor.Key);
        }