public async Task Send_cancel_request_to_amazon_swf() { var cancelRequest = new CancelWorkflowRequest("workflowId") { WorkflowRunId = "runid" }; await _domain.CancelWorkflowAsync(cancelRequest); AssertThatAmazonSwfIsSend(cancelRequest); }
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); }
/// <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)); }