public async Task CanProcess_ActionUnsuccesful_DoesNotRemoveSqsMessage() { var elvis = new PersonMessage { Id = Guid.NewGuid(), Name = "Elvis" }; var processor = new PersonConsumer(sqsClient.Object, SqsUrl, x => Task.FromResult(false)); var message = new SQSEvent.SQSMessage { Body = elvis.ToJson() }; await processor.Process(new[] { message }); sqsClient.Verify(x => x.DeleteMessageAsync(It.IsAny <DeleteMessageRequest>(), new CancellationToken()), Times.Never); }
public void CanProcessMessage() { var processor = new PersonProcessor(consumer.Object, publisher.Object); var elvis = new PersonMessage { Id = Guid.NewGuid(), Name = "Elvis" }; var message = new SQSEvent.SQSMessage { Body = elvis.ToJson() }; consumer.Setup(x => x.Process(new[] { message })) .Returns(Task.CompletedTask); processor.Process(new[] { message }); }
public void CanProcess_RemovedSqsMessage() { var elvis = new PersonMessage { Id = Guid.NewGuid(), Name = "Elvis" }; var processor = new PersonConsumer(sqsClient.Object, SqsUrl, x => { x.Done = true; return(Task.FromResult(true)); }); sqsClient.Setup(x => x.DeleteMessageAsync(It.IsAny <DeleteMessageRequest>(), new CancellationToken())); var message = new SQSEvent.SQSMessage { Body = elvis.ToJson() }; processor.Process(new[] { message }); }