Пример #1
0
        public void Remove_删除部署的流程_先部署一个流程_然后应能正常删除(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string bpmnName       = string.Join("", ctx.Guid2IntString(Guid.NewGuid()));
                Deployment deployment = AsyncHelper.RunSync <Deployment>(() => Save(bpmnFile, bpmnName));

                AsyncHelper.RunSync(() => client.Remove(deployment.Id));
            });

            Assert.Null(ex);
        }
Пример #2
0
        public void Remove_删除部署的流程_先部署一个流程_然后应能正常删除(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string bpmnName       = string.Join("", ctx.Guid2IntString(Guid.NewGuid()));
                Deployment deployment = Save(bpmnFile, bpmnName).GetAwaiter().GetResult();

                client.Remove(deployment.Id).GetAwaiter().GetResult();
            });

            Assert.Null(ex);
        }
Пример #3
0
        public void Remove_删除部署的流程_如果当前流程已存在实例则抛出异常_否则删除(string bpmnFile)
        {
            var ex = Record.Exception(() =>
            {
                string bpmnName       = string.Join("", ctx.Guid2IntString(Guid.NewGuid()));
                Deployment deployment = AsyncHelper.RunSync <Deployment>(() => ctx.DeployAsync(bpmnFile, bpmnName));

                IProcessInstanceController instanceController = ctx.CreateWorkflowHttpProxy().GetProcessInstanceClient();

                StartProcessInstanceCmd cmd = new StartProcessInstanceCmd
                {
                    ProcessName = bpmnName,
                    TenantId    = ctx.TenantId,
                    Variables   = new Dictionary <string, object>
                    {
                        { "name", new string[] { "用户1" } }
                    },
                };
                ProcessInstance[] instances = AsyncHelper.RunSync <ProcessInstance[]>(() => instanceController.Start(new StartProcessInstanceCmd[] { cmd }));

                Assert.True(instances.Length > 0);

                IProcessDefinitionDeployerController deployerController = ctx.CreateWorkflowHttpProxy().GetDefinitionDeployerClient();

                AsyncHelper.RunSync(() => deployerController.Remove(deployment.Id));
            });

            Assert.NotNull(ex);
            Assert.IsType <Http400Exception>(ex);
        }