public async Task RaiseTestEvent() { var config = new AmazonSimpleNotificationServiceConfig { RegionEndpoint = RegionEndpoint.EUWest1 }; var sns = new AmazonSimpleNotificationServiceClient(config); var options = new NybusBridgeOptions { TopicArn = "arn:aws:sns:eu-west-1:123457890:your-topic-arn" }; var bridge = new SnsNybusBridge(sns, options); await bridge.RaiseEvent(new TestEvent { Value = "Foo Bar" }); }
public void RaiseEvent_should_throw_if_TopicArn_is_null([Frozen] NybusBridgeOptions options, SnsNybusBridge sut, TestEvent @event, Guid correlationId) { options.TopicArn = null; Assert.ThrowsAsync <ArgumentNullException>(() => sut.RaiseEvent(@event, correlationId)); }
public void InvokeCommand_should_throw_if_TopicArn_is_null([Frozen] NybusBridgeOptions options, SnsNybusBridge sut, TestCommand command, Guid correlationId) { options.TopicArn = null; Assert.ThrowsAsync <ArgumentNullException>(() => sut.InvokeCommand(command, correlationId)); }
public async Task RaiseEvent_should_publish_correct_message([Frozen] IAmazonSimpleNotificationService sns, [Frozen] NybusBridgeOptions options, SnsNybusBridge sut, TestEvent @event, Guid correlationId) { await sut.RaiseEvent(@event, correlationId); Mock.Get(sns).Verify(p => p.PublishAsync(options.TopicArn, It.Is <string>(message => ValidateEvent(message, @event)), It.IsAny <CancellationToken>())); }
public async Task InvokeCommand_should_publish_correct_message([Frozen] IAmazonSimpleNotificationService sns, [Frozen] NybusBridgeOptions options, SnsNybusBridge sut, TestCommand command, Guid correlationId) { await sut.InvokeCommand(command, correlationId); Mock.Get(sns).Verify(p => p.PublishAsync(options.TopicArn, It.Is <string>(message => ValidateCommand(message, command)), It.IsAny <CancellationToken>())); }