Beispiel #1
0
        public void UpdateUserDelegationTest()
        {
            //新增或修改
            string             userID     = UuidHelper.NewUuidString();
            string             duserID    = UuidHelper.NewUuidString();
            WfClientDelegation delegation = DelegationHelper.PrepareDelegation();

            delegation.SourceUserID = userID;
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation);//新增加
            int count = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(delegation.SourceUserID).Count;

            Assert.AreEqual(1, count);

            delegation.DestinationUserID = duserID;                                          //修改被委托人信息
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation); //新增加
            count = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(delegation.SourceUserID).Count;
            Assert.AreEqual(2, count);

            delegation.StartTime = System.DateTime.Now.Date;
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation);//更新
            count = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(delegation.SourceUserID).Count;
            Assert.AreEqual(2, count);

            WfClientDelegationCollection list        = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(delegation.SourceUserID);
            WfClientDelegation           delegation2 = list.Find(w => w.DestinationUserID == duserID);

            //传递过程,客户端扩展的属性会丢失
            delegation.ApplicationName = string.Empty;
            delegation.TenantCode      = string.Empty;
            delegation.ProgramName     = string.Empty;

            delegation.AreSame(delegation2);
        }
Beispiel #2
0
        public static void AreSame(this WfClientDelegationCollection expected, WfClientDelegationCollection actual)
        {
            Assert.AreEqual(expected.Count, actual.Count);

            for (int i = 0; i < expected.Count; i++)
            {
                expected[i].AreSame(actual[i]);
            }
        }
        public static WfClientDelegationCollection PrepareDelegations(string userID)
        {
          
            WfClientDelegationCollection delegations = new WfClientDelegationCollection();
            WfClientDelegation delegation = PrepareDelegation();
            delegation.SourceUserID = userID;
            delegation.SourceUserName = "******" + delegation.SourceUserName;
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation);           
            delegations.Add(delegation);

            delegation = PrepareDelegation();
            delegation.SourceUserID = userID;
            delegation.SourceUserName = "******" + delegation.SourceUserName;
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation);
            delegations.Add(delegation);

            return delegations;
        }
Beispiel #4
0
        public static WfClientDelegationCollection PrepareDelegations(string userID)
        {
            WfClientDelegationCollection delegations = new WfClientDelegationCollection();
            WfClientDelegation           delegation  = PrepareDelegation();

            delegation.SourceUserID   = userID;
            delegation.SourceUserName = "******" + delegation.SourceUserName;
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation);
            delegations.Add(delegation);

            delegation = PrepareDelegation();
            delegation.SourceUserID   = userID;
            delegation.SourceUserName = "******" + delegation.SourceUserName;
            WfClientProcessDescriptorServiceProxy.Instance.UpdateUserDelegation(delegation);
            delegations.Add(delegation);

            return(delegations);
        }
Beispiel #5
0
        public void LoadUserDelegationsTest()
        {
            string userID = UuidHelper.NewUuidString();
            WfClientDelegationCollection delegations = DelegationHelper.PrepareDelegations(userID);
            WfClientDelegationCollection sd          = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(userID);

            //传递过程,客户端扩展的属性会丢失
            delegations.ForEach(action =>
            {
                action.ApplicationName = string.Empty;
                action.ProgramName     = string.Empty;
                action.TenantCode      = string.Empty;
            });

            //默认排序
            sd.Sort((m, n) => m.SourceUserName.CompareTo(n.SourceUserName));

            delegations.AreSame(sd);
        }
Beispiel #6
0
        public void DeleteUserDelegationTest()
        {
            string userID = UuidHelper.NewUuidString();
            WfClientDelegationCollection delegations  = DelegationHelper.PrepareDelegations(userID);
            WfClientDelegationCollection delegations2 = DelegationHelper.PrepareDelegations(userID);

            delegations2.ForEach(action => delegations.Add(action));//同一委托人构建多条委托数据

            int count = delegations.Count;

            Assert.IsTrue(count > 2);
            WfClientDelegation delegation = delegations[0];

            WfClientProcessDescriptorServiceProxy.Instance.DeleteUserDelegation(delegation);
            int tmpCount = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(userID).Count;

            Assert.AreEqual(count - 1, tmpCount);

            WfClientProcessDescriptorServiceProxy.Instance.DeleteUserDelegation(userID);
            tmpCount = WfClientProcessDescriptorServiceProxy.Instance.LoadUserDelegations(userID).Count;
            Assert.AreEqual(0, tmpCount);
        }
        public static void AreSame(this WfClientDelegationCollection expected, WfClientDelegationCollection actual)
        {
            Assert.AreEqual(expected.Count, actual.Count);

            for (int i = 0; i < expected.Count; i++)
            {
                expected[i].AreSame(actual[i]);
            }
        }