예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }