public void ShouldTimeoutRequest()
        {
            // given
            const int JobKey = 255;

            // when
            var task = ZeebeClient.NewThrowErrorCommand(JobKey)
                       .ErrorCode("code 13")
                       .ErrorMessage("This is a business error!")
                       .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
            const int jobKey = 255;

            // when
            var task = ZeebeClient.NewThrowErrorCommand(jobKey)
                       .ErrorCode("code 13")
                       .ErrorMessage("This is a business error!")
                       .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
            const string errorCode       = "code 13";
            const string errorMessage    = "This is a business error!";
            const int    JobKey          = 255;
            var          expectedRequest = new ThrowErrorRequest
            {
                JobKey       = JobKey,
                ErrorCode    = errorCode,
                ErrorMessage = errorMessage,
            };

            // when
            await ZeebeClient.NewThrowErrorCommand(JobKey)
            .ErrorCode("code 13")
            .ErrorMessage("This is a business error!")
            .Send();

            // then
            var actualRequest = TestService.Requests[typeof(ThrowErrorRequest)][0];

            Assert.AreEqual(expectedRequest, actualRequest);
        }