Ejemplo n.º 1
0
        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" });
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public void RaiseEvent_throws_if_event_is_null(SnsNybusBridge sut, Guid correlationId)
 {
     Assert.ThrowsAsync <ArgumentNullException>(() => sut.RaiseEvent <TestEvent>(null, correlationId));
 }
Ejemplo n.º 4
0
        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>()));
        }
Ejemplo n.º 5
0
        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));
        }
Ejemplo n.º 6
0
 public void InvokeCommand_throws_if_command_is_null(SnsNybusBridge sut, Guid correlationId)
 {
     Assert.ThrowsAsync <ArgumentNullException>(() => sut.InvokeCommand <TestCommand>(null, correlationId));
 }
Ejemplo n.º 7
0
        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>()));
        }