コード例 #1
0
ファイル: UsageTests.cs プロジェクト: raffii90/dotnet-utils
        public async Task InvokeTestCommand()
        {
            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.InvokeCommand(new TestCommand { Value = "Foo Bar" });
        }
コード例 #2
0
 public void InvokeCommand_throws_if_command_is_null(SnsNybusBridge sut, Guid correlationId)
 {
     Assert.ThrowsAsync <ArgumentNullException>(() => sut.InvokeCommand <TestCommand>(null, correlationId));
 }
コード例 #3
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));
        }
コード例 #4
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>()));
        }