Пример #1
0
        public async Task 任务转审单人(string bpmnFile)
        {
            var ex = await Record.ExceptionAsync(async() =>
            {
                string sid = Guid.NewGuid().ToString();
                ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, new string[] { sid }));

                Assert.NotNull(instances);
                Assert.True(instances.Count() > 0);

                ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                var tasks = await tc.MyTasks(sid).ConfigureAwait(false);

                var uid = Guid.NewGuid().ToString();

                TaskModel[] model = await tc.TransferTask(new TransferTaskCmd
                {
                    TaskId      = tasks.List.FirstOrDefault().Id,
                    Assignees   = new string[] { uid },
                    Description = "转审测试"
                }).ConfigureAwait(false);

                tasks = await tc.MyTasks(uid).ConfigureAwait(false);

                await tc.CompleteTask(new CompleteTaskCmd
                {
                    TaskId = tasks.List.First().Id
                }).ConfigureAwait(false);

                tasks = await tc.MyTasks(uid).ConfigureAwait(false);
            });

            Assert.Null(ex);
        }
Пример #2
0
        public void 主活动终止事件同时终止子活动(string bpmnFile, string subBpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string 主任务        = Guid.NewGuid().ToString();
                string 一任务        = Guid.NewGuid().ToString();
                string[] subUsers = new string[]
                {
                    Guid.NewGuid().ToString()
                };
                string[] subUsers1 = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                var bizIds = new string[]
                {
                    Guid.NewGuid().ToString()
                };

                ctx.Deploy(bpmnFile);
                ctx.Deploy(subBpmnFile);

                WorkflowVariable vars = new WorkflowVariable();
                vars.AddAssignee(nameof(主任务), 主任务)
                .AddAssignee(nameof(一任务), 一任务)
                .AddAssignee(nameof(subUsers), subUsers)
                .AddAssignee(nameof(subUsers1), subUsers1);
                vars.Add("ids", bizIds);

                string bizId = Guid.NewGuid().ToString();
                ProcessInstance[] instances = ctx.StartUseFile(bpmnFile, null, vars, businessKey: bizId).GetAwaiter().GetResult();

                ITaskController taskClient = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                Assert.NotEmpty(taskClient.MyTasks(主任务).GetAwaiter().GetResult().List);
                Assert.NotEmpty(taskClient.MyTasks(subUsers[0]).GetAwaiter().GetResult().List);

                ///完成主任务节点的任务
                taskClient.CompleteTask(new CompleteTaskCmd
                {
                    BusinessKey = bizId,
                    Assignee    = 主任务
                }).GetAwaiter().GetResult();

                Assert.Empty(taskClient.MyTasks(subUsers[0]).GetAwaiter().GetResult().List);
                Assert.Empty(taskClient.MyTasks(一任务).GetAwaiter().GetResult().List);

                var pi = ctx.CreateWorkflowHttpProxy().GetProcessInstanceClient().GetProcessInstanceById(instances[0].Id).GetAwaiter().GetResult();
            });

            Assert.NotNull(ex);
        }
Пример #3
0
        public async Task 变量抛异常(string bpmnFile)
        {
            var ex = await Record.ExceptionAsync(async() =>
            {
                string uid = Guid.NewGuid().ToString();
                ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, new string[0], new Dictionary <string, object>
                {
                    { "starter", new string[] { uid } }
                }));

                ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                Resources <TaskModel> tasks = await tc.MyTasks(uid).ConfigureAwait(false);

                TaskModel task = tasks.List.FirstOrDefault(x => x.Status == "ASSIGNED");

                await tc.CompleteTask(new CompleteTaskCmd
                {
                    TaskId = task.Id
                }).ConfigureAwait(false);

                Assert.NotNull(instances);
                Assert.True(instances.Count() > 0);
            }).ConfigureAwait(false);

            Assert.NotNull(ex);
        }
Пример #4
0
        private async Task <Resources <TaskModel> > Complete(ITaskController tc, string userId, WorkflowVariable vars)
        {
            Resources <TaskModel> tasks = await tc.MyTasks(userId).ConfigureAwait(false);

            TaskModel task = tasks.List.FirstOrDefault();

            await tc.CompleteTask(new CompleteTaskCmd
            {
                TaskId          = task.Id,
                OutputVariables = vars
            }).ConfigureAwait(false);

            tasks = await tc.MyTasks(userId).ConfigureAwait(false);

            return(tasks);
        }
Пример #5
0
        public void 协同审批分支流程(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, null, new Dictionary <string, object>
                {
                    ["同意"] = false
                }));

                ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                Thread.Sleep(1000);

                var tasks = AsyncHelper.RunSync(() => tc.MyTasks("8e45aba4-c648-4d71-a1c3-3d15b5518b84"));

                var task = tasks.List.ElementAt(0);

                tc.Approvaled(new ApprovaleTaskCmd {
                    TaskId = task.Id
                });

                Assert.NotNull(instances);
                Assert.True(instances.Count() > 0);
            });

            Assert.Null(ex);
        }
Пример #6
0
        public void 协同审批一票否决(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string[] users = new string[]
                {
                    "8e45aba4-c648-4d71-a1c3-3d15b5518b84",
                    "1f387de4-0e26-47dd-b2f1-57771a268bc5",
                    //"e561d025-76c7-4674-b799-5eae802a4980"
                };

                ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, null, new Dictionary <string, object>
                {
                    ["UserTask_11w47k9s"] = users
                }));

                ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                var tasks = AsyncHelper.RunSync(() => tc.MyTasks(users[0]));

                var task = tasks.List.ElementAt(0);

                tc.Approvaled(new ApprovaleTaskCmd {
                    TaskId = task.Id
                });

                Thread.Sleep(1000);

                tasks = AsyncHelper.RunSync(() => tc.MyTasks(users[1]));

                if (tasks.List.Count() > 0)
                {
                    task = tasks.List.ElementAt(0);

                    tc.Reject(new RejectTaskCmd {
                        TaskId = task.Id, RejectReason = "不同意"
                    });
                }

                Assert.NotNull(instances);
                Assert.True(instances.Count() > 0);
            });

            Assert.Null(ex);
        }
Пример #7
0
        public async Task 定时10秒后执行用户任务(string bpmnFile)
        {
            ProcessInstance[] insts         = null;
            DateTime          timerDateTime = DateTime.Now.AddSeconds(10);
            string            uid           = Guid.NewGuid().ToString();

            var ex = Record.Exception(() =>
            {
                insts = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, new string[] { uid }, new Dictionary <string, object>
                {
                    { "timerDateTime", timerDateTime }
                }));
            });

            Assert.Null(ex);

            ex = await Record.ExceptionAsync(async() =>
            {
                int retry = 0;
                Resources <TaskModel> tasks = null;
                while (retry != 2)
                {
                    Thread.Sleep(15000);

                    ITaskController client = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                    tasks = await client.MyTasks(uid).ConfigureAwait(false);

                    if (tasks?.List.Count() == 0)
                    {
                        retry += 1;
                        continue;
                    }
                    break;
                }
            }).ConfigureAwait(false);

            Assert.Null(ex);
        }
Пример #8
0
        public void 部分完成并行子活动(string bpmnFile, string subBpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string teachers   = Guid.NewGuid().ToString();
                string students   = Guid.NewGuid().ToString();
                string[] subUsers = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                string[] subUsers1 = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                var bizIds = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };

                ctx.Deploy(bpmnFile);
                ctx.Deploy(subBpmnFile);

                WorkflowVariable vars = new WorkflowVariable();
                vars.AddAssignee(nameof(teachers), teachers)
                .AddAssignee(nameof(students), students)
                .AddAssignee(nameof(subUsers), subUsers)
                .AddAssignee(nameof(subUsers1), subUsers1);
                vars.Add("ids", bizIds);

                string bizId = Guid.NewGuid().ToString();
                ProcessInstance[] instances = ctx.StartUseFile(bpmnFile, null, vars, businessKey: bizId).GetAwaiter().GetResult();

                ITaskController taskClient = ctx.CreateWorkflowHttpProxy().GetTaskClient();
                ///完成子任务节点1的任务
                foreach (var uid in subUsers)
                {
                    var myTasks = taskClient.MyTasks(uid).GetAwaiter().GetResult().List.ToList();
                    myTasks.ForEach(tsk =>
                    {
                        taskClient.CompleteTask(new CompleteTaskCmd
                        {
                            TaskId = tsk.Id
                        }).GetAwaiter().GetResult();
                    });
                }

                {
                    //任务节点1仅完成子用户1的任务,子活动1应该停在任务节点2
                    var myTask = taskClient.MyTasks(subUsers1[0]).GetAwaiter().GetResult().List.First();
                    _          = taskClient.CompleteTask(new CompleteTaskCmd
                    {
                        TaskId = myTask.Id
                    }).GetAwaiter().GetResult();

                    //完成子活动2的所有任务
                    var myTasks = taskClient.MyTasks(subUsers1[1]).GetAwaiter().GetResult().List.ToList();
                    myTasks.ForEach(tsk => taskClient.CompleteTask(new CompleteTaskCmd
                    {
                        TaskId = tsk.Id
                    }).GetAwaiter().GetResult());

                    Assert.NotEmpty(taskClient.MyTasks(subUsers1[0]).GetAwaiter().GetResult().List);
                }

                var sTasks = taskClient.MyTasks(students).GetAwaiter().GetResult().List;

                Assert.Empty(sTasks);
            });

            Assert.Null(ex);
        }
Пример #9
0
        public void 调用子活动(string bpmnFile, string subBpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string teachers   = Guid.NewGuid().ToString();
                string students   = Guid.NewGuid().ToString();
                string[] subUsers = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                string[] subUsers1 = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                var bizIds = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };

                ctx.Deploy(bpmnFile);
                ctx.Deploy(subBpmnFile);

                WorkflowVariable vars = new WorkflowVariable();
                vars.AddAssignee(nameof(teachers), teachers)
                .AddAssignee(nameof(students), students)
                .AddAssignee(nameof(subUsers), subUsers)
                .AddAssignee(nameof(subUsers1), subUsers1);

                string bizId = Guid.NewGuid().ToString();
                ProcessInstance[] instances = ctx.StartUseFile(bpmnFile, null, vars, businessKey: bizId).GetAwaiter().GetResult();

                ITaskController taskClient = ctx.CreateWorkflowHttpProxy().GetTaskClient();
                TaskModel task             = taskClient.MyTasks(teachers).GetAwaiter().GetResult().List.FirstOrDefault();

                _ = taskClient.CompleteTask(new CompleteTaskCmd
                {
                    TaskId          = task.Id,
                    OutputVariables = WorkflowVariable.FromObject(new
                    {
                        ids = bizIds,
                        完成  = true
                    }),
                    NotFoundThrowError = true
                }).GetAwaiter().GetResult();

                Resources <TaskModel> tasks = ctx.CreateWorkflowHttpProxy().GetProcessInstanceTasksClient()
                                              .GetTasks(new ProcessInstanceTaskQuery()
                {
                    IncludeCompleted  = false,
                    ProcessInstanceId = instances[0].Id
                }).GetAwaiter().GetResult();

                foreach (var uid in subUsers)
                {
                    var myTasks = taskClient.MyTasks(uid).GetAwaiter().GetResult().List.ToList();
                    myTasks.ForEach(tsk => taskClient.CompleteTask(new CompleteTaskCmd {
                        TaskId = tsk.Id
                    }).GetAwaiter().GetResult());
                }

                foreach (var uid in subUsers1)
                {
                    var myTasks = taskClient.MyTasks(uid).GetAwaiter().GetResult().List.ToList();
                    myTasks.ForEach(tsk => taskClient.CompleteTask(new CompleteTaskCmd {
                        TaskId = tsk.Id
                    }).GetAwaiter().GetResult());
                }

                var sTasks = taskClient.MyTasks(students).GetAwaiter().GetResult().List.ToList();
                sTasks.ForEach(tsk => taskClient.CompleteTask(new CompleteTaskCmd {
                    TaskId = tsk.Id
                }).GetAwaiter().GetResult());

                ctx.CreateWorkflowHttpProxy().GetProcessInstanceClient().GetProcessInstanceById(instances[0].Id).GetAwaiter().GetResult();
            });

            Assert.NotNull(ex);
        }
Пример #10
0
        public void 使用子活动BUSINEEKEY完成并行子活动(string bpmnFile, string subBpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string teachers   = Guid.NewGuid().ToString();
                string students   = Guid.NewGuid().ToString();
                string[] subUsers = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                string[] subUsers1 = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                var bizIds = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };

                ctx.Deploy(bpmnFile);
                ctx.Deploy(subBpmnFile);

                WorkflowVariable vars = new WorkflowVariable();
                vars.AddAssignee(nameof(teachers), teachers)
                .AddAssignee(nameof(students), students)
                .AddAssignee(nameof(subUsers), subUsers)
                .AddAssignee(nameof(subUsers1), subUsers1);
                vars.Add("ids", bizIds);

                string bizId = Guid.NewGuid().ToString();
                ProcessInstance[] instances = ctx.StartUseFile(bpmnFile, null, vars, businessKey: bizId).GetAwaiter().GetResult();

                ITaskController taskClient = ctx.CreateWorkflowHttpProxy().GetTaskClient();
                ///完成子任务节点1的任务
                foreach (var uid in subUsers)
                {
                    foreach (var bid in bizIds)
                    {
                        taskClient.CompleteTask(new CompleteTaskCmd
                        {
                            Assignee    = uid,
                            BusinessKey = bid
                        }).GetAwaiter().GetResult();
                    }
                }

                //完成子活动1,2的所有任务
                foreach (var uid in subUsers1)
                {
                    foreach (var bid in bizIds)
                    {
                        taskClient.CompleteTask(new CompleteTaskCmd
                        {
                            Assignee    = uid,
                            BusinessKey = bid
                        }).GetAwaiter().GetResult();
                    }
                }

                var sTasks = taskClient.MyTasks(students).GetAwaiter().GetResult().List;

                Assert.NotEmpty(sTasks);
            });

            Assert.Null(ex);
        }
Пример #11
0
        public void 完成并行子活动(string bpmnFile, string subBpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string teachers   = Guid.NewGuid().ToString();
                string students   = Guid.NewGuid().ToString();
                string[] subUsers = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                string[] subUsers1 = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                var bizIds = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };

                ctx.Deploy(bpmnFile);
                ctx.Deploy(subBpmnFile);

                WorkflowVariable vars = new WorkflowVariable();
                vars.AddAssignee(nameof(teachers), teachers)
                .AddAssignee(nameof(students), students)
                .AddAssignee(nameof(subUsers), subUsers)
                .AddAssignee(nameof(subUsers1), subUsers1);
                vars.Add("ids", bizIds);

                string bizId = Guid.NewGuid().ToString();
                ProcessInstance[] instances = ctx.StartUseFile(bpmnFile, null, vars, businessKey: bizId).GetAwaiter().GetResult();

                ITaskController taskClient = ctx.CreateWorkflowHttpProxy().GetTaskClient();
                ///完成子任务节点1的任务
                foreach (var uid in subUsers)
                {
                    var myTasks = taskClient.MyTasks(uid).GetAwaiter().GetResult().List;
                    Task.WhenAll(Enumerable.Select(myTasks, (task) =>
                    {
                        return(taskClient.CompleteTask(new CompleteTaskCmd
                        {
                            TaskId = task.Id
                        }));
                    })).GetAwaiter().GetResult();
                }

                {
                    //完成子活动1,2的所有任务
                    foreach (var uid in subUsers1)
                    {
                        var myTasks = taskClient.MyTasks(uid).GetAwaiter().GetResult().List;
                        taskClient.CompleteTask(myTasks.Select(tsk => new CompleteTaskCmd
                        {
                            TaskId = tsk.Id
                        }).ToArray()).GetAwaiter().GetResult();
                    }
                }

                var sTasks = taskClient.MyTasks(students).GetAwaiter().GetResult().List;

                Assert.NotEmpty(sTasks);
            });

            Assert.Null(ex);
        }
Пример #12
0
        public void 协同审批一人通过(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                int count = 0;

                string[] users = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString(),
                };

                while (count < 10)
                {
                    ProcessDefinition process = ctx.GetOrAddProcessDefinition(bpmnFile);

                    ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(process, new Dictionary <string, object>
                    {
                        ["UserTask_11w47k9s"] = users
                    }));

                    count += 1;
                }

                count = 0;
                while (count < 10)
                {
                    ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                    bool approvaled = true;
                    foreach (var uid in users)
                    {
                        var tasks = AsyncHelper.RunSync(() => tc.MyTasks(uid));

                        foreach (var task in tasks.List)
                        {
                            //if (approvaled)
                            //{
                            //    tc.Approvaled(new ApprovaleTaskCmd { TaskId = task.Id });
                            //}
                            //else
                            //{
                            tc.Reject(new RejectTaskCmd {
                                TaskId = task.Id, RejectReason = "不同意"
                            });
                            //}
                            approvaled = !approvaled;
                        }
                    }

                    count += 1;
                }
                ;
            });

            Assert.Null(ex);
        }
Пример #13
0
        public void 协同审批半数拒绝(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string[] users = new string[]
                {
                    "8e45aba4-c648-4d71-a1c3-3d15b5518b84",
                    "1f387de4-0e26-47dd-b2f1-57771a268bc5",
                    "e561d025-76c7-4674-b799-5eae802a4980"
                };

                ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, null, new Dictionary <string, object>
                {
                    ["UserTask_11w47k9s"] = users
                }));

                var action = new Action <string, bool>((uid, app) =>
                {
                    ITaskController tc = ctx.CreateWorkflowHttpProxy().GetTaskClient();

                    var tasks = AsyncHelper.RunSync(() => tc.MyTasks(uid));

                    if (tasks.RecordCount > 0)
                    {
                        var task = tasks.List.ElementAt(0);

                        if (app)
                        {
                            tc.Approvaled(new ApprovaleTaskCmd {
                                TaskId = task.Id
                            });
                        }
                        else
                        {
                            tc.Reject(new RejectTaskCmd
                            {
                                TaskId       = task.Id,
                                RejectReason = "半数拒绝"
                            });
                        }
                    }
                });

                action(users[0], false);

                action(users[1], true);

                action(users[2], false);

                IProcessInstanceHistoriceController pvc = ctx.CreateWorkflowHttpProxy().GetProcessInstanceHistoriceClient();

                var variables = AsyncHelper.RunSync(() => pvc.GetVariables(new ProcessVariablesQuery
                {
                    ProcessInstanceId    = instances[0].Id,
                    ExcludeTaskVariables = true,
                    VariableName         = WorkflowVariable.GLOBAL_APPROVALED_VARIABLE
                }));
            });

            Assert.Null(ex);
        }
Пример #14
0
        public async Task <Resources <TaskModel> > MyTasks()
        {
            IUserInfo user = await accessToken.FromRequestHeaderAsync(httpContext);

            return(await taskClient.MyTasks(user.Id));
        }
Пример #15
0
        public void 部分完成并行子活动(string bpmnFile, string subBpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string teachers   = Guid.NewGuid().ToString();
                string students   = Guid.NewGuid().ToString();
                string[] subUsers = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                string[] subUsers1 = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };
                var bizIds = new string[]
                {
                    Guid.NewGuid().ToString(),
                    Guid.NewGuid().ToString()
                };

                ctx.Deploy(bpmnFile);
                ctx.Deploy(subBpmnFile);

                WorkflowVariable vars = new WorkflowVariable();
                vars.AddAssignee(nameof(teachers), teachers)
                .AddAssignee(nameof(students), students)
                .AddAssignee(nameof(subUsers), subUsers)
                .AddAssignee(nameof(subUsers1), subUsers1);

                string bizId = Guid.NewGuid().ToString();
                ProcessInstance[] instances = AsyncHelper.RunSync(() => ctx.StartUseFile(bpmnFile, null, vars, businessKey: bizId));

                ITaskController taskClient = ctx.CreateWorkflowHttpProxy().GetTaskClient();
                TaskModel task             = AsyncHelper.RunSync(() => taskClient.MyTasks(teachers)).List.FirstOrDefault();

                _ = AsyncHelper.RunSync(() => taskClient.CompleteTask(new CompleteTaskCmd
                {
                    TaskId          = task.Id,
                    OutputVariables = WorkflowVariable.FromObject(new
                    {
                        ids = bizIds,
                        完成  = true
                    }),
                    NotFoundThrowError = true
                }));

                ///完成子任务节点1的任务
                foreach (var uid in subUsers)
                {
                    var myTasks = AsyncHelper.RunSync(() => taskClient.MyTasks(uid)).List.ToList();
                    myTasks.ForEach(tsk => AsyncHelper.RunSync(() => taskClient.CompleteTask(new CompleteTaskCmd {
                        TaskId = tsk.Id
                    })));
                }

                {
                    //任务节点1仅完成子用户1的任务,子活动1应该停在任务节点2
                    var myTask = AsyncHelper.RunSync(() => taskClient.MyTasks(subUsers1[0])).List.First();
                    AsyncHelper.RunSync(() => taskClient.CompleteTask(new CompleteTaskCmd {
                        TaskId = myTask.Id
                    }));

                    //完成子活动2的所有任务
                    var myTasks = AsyncHelper.RunSync(() => taskClient.MyTasks(subUsers1[1])).List.ToList();
                    myTasks.ForEach(tsk => AsyncHelper.RunSync(() => taskClient.CompleteTask(new CompleteTaskCmd {
                        TaskId = tsk.Id
                    })));
                }

                var sTasks = AsyncHelper.RunSync(() => taskClient.MyTasks(students)).List;

                Assert.Empty(sTasks);
            });

            Assert.Null(ex);
        }