public async Task ItWorks(int messageCount)
        {
            using (var scope = new RebusTransactionScope())
            {
                var context = scope.TransactionContext;

                messageCount.Times(() => _transport.Send(_inputQueueAddress, MessageWith("message-1"), context).Wait());

                await scope.CompleteAsync();
            }

            var receivedMessages = await _transport.ReceiveAll();

            Assert.That(receivedMessages.Count, Is.EqualTo(messageCount));
        }
Exemple #2
0
        public async Task CanRoundtripSingleMessageWithTransport()
        {
            const string positiveGreeting = "hej meeeeed dig min vennnnn!!!!!!111";

            await WithContext(async context =>
            {
                var message = new TransportMessage(NewFineHeaders(), Encoding.UTF8.GetBytes(positiveGreeting));

                await _transport.Send(_brilliantQueueName, message, context);
            });

            var receivedMessage = await _transport.WaitForNextMessage();

            Assert.That(Encoding.UTF8.GetString(receivedMessage.Body), Is.EqualTo(positiveGreeting));
        }