public void ShouldTimeoutRequest() { // given // when var task = ZeebeClient.NewCancelInstanceCommand(12113) .Send(TimeSpan.Zero); var aggregateException = Assert.Throws <AggregateException>(() => task.Wait()); var rpcException = (RpcException)aggregateException.InnerExceptions[0]; // then Assert.AreEqual(Grpc.Core.StatusCode.DeadlineExceeded, rpcException.Status.StatusCode); }
public void ShouldCancelRequest() { // given // when var task = ZeebeClient.NewCancelInstanceCommand(12113) .Send(new CancellationTokenSource(TimeSpan.Zero).Token); var aggregateException = Assert.Throws <AggregateException>(() => task.Wait()); var rpcException = (RpcException)aggregateException.InnerExceptions[0]; // then Assert.AreEqual(StatusCode.Cancelled, rpcException.Status.StatusCode); }
public async Task ShouldSendRequestAsExpected() { // given var expected = new CancelWorkflowInstanceRequest { WorkflowInstanceKey = 12113 }; // when await ZeebeClient.NewCancelInstanceCommand(12113).Send(); // then var request = TestService.Requests[typeof(CancelWorkflowInstanceRequest)][0]; Assert.AreEqual(expected, request); }
public void ShouldNotRetrySendRequest() { // given TestService.AddRequestHandler( typeof(CancelProcessInstanceRequest), req => { throw new RpcException(new Status(StatusCode.Internal, "exhausted")); }); // when var resultTask = ZeebeClient.NewCancelInstanceCommand(12113).SendWithRetry(); var aggregateException = Assert.Throws <AggregateException>(() => resultTask.Wait()); var rpcException = (RpcException)aggregateException.InnerExceptions[0]; // then Assert.AreEqual(StatusCode.Internal, rpcException.Status.StatusCode); }