private async Task ThenTheSubscriberReceivesBothMessages()
        {
            await Patiently.AssertThatAsync(
                () => _handler.HasReceived(_message1));

            await Patiently.AssertThatAsync(
                () => _handler.HasReceived(_message2));
        }
Beispiel #2
0
        private async Task ThenTheSubscriberReceivesBothMessages()
        {
            var done = await Tasks.WaitWithTimeoutAsync(_handler.DoneSignal);

            done.ShouldBeTrue();

            _handler.ReceivedMessageCount.ShouldBeGreaterThanOrEqualTo(2);
            _handler.HasReceived(_message1).ShouldBeTrue("The first message was not received.");
            _handler.HasReceived(_message2).ShouldBeTrue("The second message was not received.");
        }
        private async Task ThenTheSubscriberReceivesBothMessages()
        {
            var done = await Tasks.WaitWithTimeoutAsync(_handler.DoneSignal);

            Assert.That(done, Is.True);

            Assert.That(_handler.ReceivedMessageCount, Is.GreaterThanOrEqualTo(2));
            Assert.That(_handler.HasReceived(_message1));
            Assert.That(_handler.HasReceived(_message2));
        }
        private async Task ThenTheMessageIsReceivedInThatRegion(Future <SimpleMessage> handler, string regionName)
        {
            var done = await Tasks.WaitWithTimeoutAsync(handler.DoneSignal);

            done.ShouldBeTrue($"Handler did not complete in region {regionName}.");

            handler.ReceivedMessageCount.ShouldBeGreaterThanOrEqualTo(1, $"Received message count was incorrect in region {regionName}.");
            handler.HasReceived(_message).ShouldBeTrue($"Message was not received in region {regionName}.");
        }
        private async Task ThenTheMessageIsReceivedInThatRegion(Future <GenericMessage> handler)
        {
            var done = await Tasks.WaitWithTimeoutAsync(handler.DoneSignal);

            Assert.That(done, Is.True);

            Assert.That(handler.ReceivedMessageCount, Is.GreaterThanOrEqualTo(1));
            Assert.That(handler.HasReceived(_message));
        }
Beispiel #6
0
        private async Task ThenTheMessageIsReceivedInThatRegion(Future <GenericMessage> handler)
        {
            var done = await Tasks.WaitWithTimeoutAsync(handler.DoneSignal);

            done.ShouldBeTrue();

            handler.ReceivedMessageCount.ShouldBeGreaterThanOrEqualTo(1);
            handler.HasReceived(_message).ShouldBeTrue();
        }
Beispiel #7
0
        public async Task ICanReceiveMessagePublishedToTopicInAnotherAccount()
        {
            string publisherAccount  = "<enter publisher account id>";
            string subscriberAccount = "<enter subscriber account id>";
            var    publishingBus     = GetBus("<enter publisher access key>", "<enter publisher secret key>");
            var    subscribingBus    = GetBus("<enter subscriber access key>", "<enter subscriber secret key>");

            publishingBus
            .WithNamingStrategy(() => new NamingStrategy())
            .ConfigurePublisherWith(cfg => cfg.AdditionalSubscriberAccounts = new List <string> {
                subscriberAccount
            })
            .WithSnsMessagePublisher <GenericMessage>();


            var handler = Substitute.For <IHandlerAsync <GenericMessage> >();

            handler.Handle(Arg.Any <GenericMessage>()).Returns(true);
            handler
            .When(x => x.Handle(Arg.Any <GenericMessage>()))
            .Do(async x => await _signal.Complete((GenericMessage)x.Args()[0]));

            subscribingBus
            .WithNamingStrategy(() => new NamingStrategy())
            .WithSqsTopicSubscriber()
            .IntoQueue("crossaccount")
            .ConfigureSubscriptionWith(cfg => cfg.TopicSourceAccount = publisherAccount)
            .WithMessageHandler(handler);
            subscribingBus.StartListening();

            //Act
            publishingBus.Publish(_message);

            //Assert
            var done = await Tasks.WaitWithTimeoutAsync(_signal.DoneSignal, TimeSpan.FromMinutes(1));

            Assert.That(_signal.HasReceived(_message));
        }
 private void ThenTheMessageIsReceivedInThatRegion(Future <GenericMessage> handler)
 {
     Patiently.AssertThat(() => handler.HasReceived(_message));
 }
Beispiel #9
0
 private async Task ThenTheMessageIsReceivedInThatRegion(Future <GenericMessage> handler)
 {
     await Patiently.AssertThatAsync(() => handler.HasReceived(_message));
 }
 private async Task ThenTheMessageIsReceivedInThatRegion(Future<GenericMessage> handler)
 {
     await Patiently.AssertThatAsync(() => handler.HasReceived(_message));
 }
Beispiel #11
0
 private void ThenTheSubscriberReceivesBothMessages()
 {
     Patiently.AssertThat(() => _handler.HasReceived(_message1));
     Patiently.AssertThat(() => _handler.HasReceived(_message2));
 }
        private async Task ThenTheMessageIsReceivedInThatRegion(Future<GenericMessage> handler)
        {
            var done = await Tasks.WaitWithTimeoutAsync(handler.DoneSignal);
            Assert.That(done, Is.True);

            Assert.That(handler.ReceivedMessageCount, Is.GreaterThanOrEqualTo(1));
            Assert.That(handler.HasReceived(_message));
        }
 private void ThenTheMessageIsReceivedInThatRegion(Future<GenericMessage> handler)
 {
     Patiently.AssertThat(() => handler.HasReceived(_message));
 }