public void GetProcessInstanceById_主键查找历史实例()
        {
            var ex = Record.Exception(() =>
            {
                IProcessInstanceHistoriceController client = ctx.CreateWorkflowHttpProxy().GetProcessInstanceHistoriceClient();

                HistoricInstanceQuery query = new HistoricInstanceQuery();
                query.TenantId = ctx.TenantId;
                query.Pageable = new Pageable
                {
                    PageNo   = 1,
                    PageSize = 1
                };

                Resources <HistoricInstance> list = client.ProcessInstances(query).GetAwaiter().GetResult();
                if (list.TotalCount == 0)
                {
                    return;
                }

                HistoricInstance inst = client.GetProcessInstanceById(list.List.First().Id).GetAwaiter().GetResult();

                Assert.NotNull(inst);
            });

            Assert.Null(ex);
        }
        public void ProcessInstances_分页获取流程历史实例列表()
        {
            var ex = Record.Exception(() =>
            {
                IProcessInstanceHistoriceController client = ctx.CreateWorkflowHttpProxy().GetProcessInstanceHistoriceClient();

                int offset = 1;
                Resources <HistoricInstance> list = null;
                while (true)
                {
                    HistoricInstanceQuery query = new HistoricInstanceQuery();
                    query.TenantId     = ctx.TenantId;
                    query.IsTerminated = true;
                    query.Pageable     = new Pageable
                    {
                        PageNo   = offset,
                        PageSize = 10,
                        Sort     = new Sort(new Sort.Order[]
                        {
                            new Sort.Order
                            {
                                Property  = "name",
                                Direction = Sort.Direction.ASC
                            }
                        })
                    };

                    list = client.ProcessInstances(query).GetAwaiter().GetResult();
                    if (list.List.Count() < 10)
                    {
                        break;
                    }

                    offset = offset + 1;
                }

                Assert.True(offset == 1 && list.TotalCount <= 0 ? true : list.TotalCount / 10 + 1 == offset);
            });

            Assert.Null(ex);
        }