Example #1
0
        public async Task Send_activity_response_on_amazon_client()
        {
            var activityResponse = new ActivityCompletedResponse("result");
            await _domain.SendActivityResponseAsync("token", activityResponse, CancellationToken.None);

            Func <RespondActivityTaskCompletedRequest, bool> req = r =>
            {
                Assert.That(r.Result, Is.EqualTo("result"));
                Assert.That(r.TaskToken, Is.EqualTo("token"));
                return(true);
            };

            _amazonWorkflowClient.Verify(c => c.RespondActivityTaskCompletedAsync(It.Is <RespondActivityTaskCompletedRequest>(r => req(r)),
                                                                                  It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task Send_activity_completed_response_to_amazon_swf()
        {
            var simpleWorkflow          = new Mock <IAmazonSimpleWorkflow>();
            var response                = new ActivityCompletedResponse("result");
            var cancellationTokenSource = new CancellationTokenSource();

            await response.SendAsync("token", simpleWorkflow.Object, cancellationTokenSource.Token);

            Func <RespondActivityTaskCompletedRequest, bool> request = r =>
            {
                Assert.That(r.TaskToken, Is.EqualTo("token"));
                Assert.That(r.Result, Is.EqualTo("result"));
                return(true);
            };

            simpleWorkflow.Verify(s => s.RespondActivityTaskCompletedAsync(It.Is <RespondActivityTaskCompletedRequest>(r => request(r)), cancellationTokenSource.Token), Times.Once);
        }