Example #1
0
        public async Task Send_cancel_request_to_amazon_swf()
        {
            var cancelRequest = new CancelWorkflowRequest("workflowId")
            {
                WorkflowRunId = "runid"
            };

            await _domain.CancelWorkflowAsync(cancelRequest);

            AssertThatAmazonSwfIsSend(cancelRequest);
        }
Example #2
0
        private void AssertThatAmazonSwfIsSend(CancelWorkflowRequest request)
        {
            Func <RequestCancelWorkflowExecutionRequest, bool> cancelRequest = s =>
            {
                Assert.That(request.WorkflowId, Is.EqualTo(s.WorkflowId));
                Assert.That(request.WorkflowRunId, Is.EqualTo(request.WorkflowRunId));
                Assert.That(_domainName, Is.EqualTo(s.Domain));
                return(true);
            };

            _amazonWorkflowClient.Verify(c => c.RequestCancelWorkflowExecutionAsync(
                                             It.Is <RequestCancelWorkflowExecutionRequest>((signal) => cancelRequest(signal)),
                                             It.IsAny <CancellationToken>()),
                                         Times.Once);
        }
Example #3
0
 /// <summary>
 /// Issue a cancellation request to running workflow.
 /// </summary>
 /// <param name="cancelRequest"></param>
 /// <returns></returns>
 public async Task CancelWorkflowAsync(CancelWorkflowRequest cancelRequest)
 {
     Ensure.NotNull(cancelRequest, nameof(cancelRequest));
     await _simpleWorkflowClient.RequestCancelWorkflowExecutionAsync(cancelRequest.SwfFormat(_name));
 }