public async Task ShouldSendDeployResourceAndGetResponseAsExpected() { // given var expectedResponse = new DeployWorkflowResponse { Key = 1 }; expectedResponse.Workflows.Add(new WorkflowMetadata { BpmnProcessId = "process", ResourceName = _demoProcessPath, Version = 1, WorkflowKey = 2 }); TestService.AddRequestHandler(typeof(DeployWorkflowRequest), request => expectedResponse); // when var deployWorkflowResponse = await ZeebeClient.NewDeployCommand() .AddResourceFile(_demoProcessPath) .Send(); // then Assert.AreEqual(1, deployWorkflowResponse.Key); Assert.AreEqual(1, deployWorkflowResponse.Workflows.Count); var workflowMetadata = deployWorkflowResponse.Workflows[0]; Assert.AreEqual("process", workflowMetadata.BpmnProcessId); Assert.AreEqual(1, workflowMetadata.Version); Assert.AreEqual(_demoProcessPath, workflowMetadata.ResourceName); Assert.AreEqual(2, workflowMetadata.WorkflowKey); }
public DeployResponse(DeployWorkflowResponse response) { Key = response.Key; Workflows = response.Workflows .Select(metadata => new WorkflowMetadata(metadata)) .Cast <IWorkflowMetadata>() .ToList(); }
public async Task ShouldSendMultipleDeployResourceAndGetResponseAsExpected() { // given var expectedResponse = new DeployWorkflowResponse { Key = 1 }; expectedResponse.Workflows.Add(new WorkflowMetadata { BpmnProcessId = "process", ResourceName = DemoProcessPath, Version = 1, WorkflowKey = 2 }); expectedResponse.Workflows.Add(new WorkflowMetadata { BpmnProcessId = "process2", ResourceName = DemoProcessPath, Version = 1, WorkflowKey = 3 }); TestService.AddRequestHandler(typeof(DeployWorkflowRequest), request => expectedResponse); // when var fileContent = File.ReadAllText(DemoProcessPath); var deployWorkflowResponse = await ZeebeClient.NewDeployCommand() .AddResourceFile(DemoProcessPath) .AddResourceString(fileContent, Encoding.UTF8, DemoProcessPath) .Send(); // then Assert.AreEqual(1, deployWorkflowResponse.Key); Assert.AreEqual(2, deployWorkflowResponse.Workflows.Count); var workflowMetadata = deployWorkflowResponse.Workflows[0]; Assert.AreEqual("process", workflowMetadata.BpmnProcessId); Assert.AreEqual(1, workflowMetadata.Version); Assert.AreEqual(DemoProcessPath, workflowMetadata.ResourceName); Assert.AreEqual(2, workflowMetadata.WorkflowKey); var workflowMetadata2 = deployWorkflowResponse.Workflows[1]; Assert.AreEqual("process2", workflowMetadata2.BpmnProcessId); Assert.AreEqual(1, workflowMetadata2.Version); Assert.AreEqual(DemoProcessPath, workflowMetadata2.ResourceName); Assert.AreEqual(3, workflowMetadata2.WorkflowKey); }