public static async Task SQSSenderSetsMessageGroupIdWhenSpecifiedInConstructor() { var mockSqs = new Mock <IAmazonSQS>(); using (var sender = new SQSSender(mockSqs.Object, "foo", new Uri("http://url.com/foo"), "abc")) { await sender.SendAsync( new SenderMessage("")) .ConfigureAwait(false); } mockSqs.Verify(m => m.SendMessageAsync( It.Is <SendMessageRequest>(r => r.MessageGroupId == "abc"), It.IsAny <CancellationToken>())); }
public static async Task SQSSenderSetsMessageDeduplicationIdWhenSpecifiedInHeader() { var mockSqs = new Mock <IAmazonSQS>(); using (var sender = new SQSSender(mockSqs.Object, "foo", new Uri("http://url.com/foo"))) { await sender.SendAsync( new SenderMessage("") { Headers = { { "SQS.MessageDeduplicationId", "abc" } } }) .ConfigureAwait(false); } mockSqs.Verify(m => m.SendMessageAsync( It.Is <SendMessageRequest>(r => !r.MessageAttributes.ContainsKey("SQS.MessageDeduplicationId") && r.MessageDeduplicationId == "abc"), It.IsAny <CancellationToken>())); }
public static async Task SQSSenderSendsMessagesToItsIAmazonSQS() { var mockSqs = new Mock <IAmazonSQS>(); using (var sender = new SQSSender(mockSqs.Object, "foo", new Uri("http://url.com/foo"))) { await sender.SendAsync( new SenderMessage("Hello, world!") { Headers = { { "bar", "abc" } } }) .ConfigureAwait(false); } mockSqs.Verify(m => m.SendMessageAsync( It.Is <SendMessageRequest>(r => r.MessageBody == "Hello, world!" && r.MessageAttributes[HeaderNames.OriginatingSystem].StringValue == "SQS" && r.MessageAttributes["bar"].StringValue == "abc"), It.IsAny <CancellationToken>())); }