public async Task AdvancedCreatePublishAndConsume()
        {
            var connectionFactory = CreateConnectionFactory();

            using (var queueClient = new RabbitMQClient(connectionFactory))
            {
                var queueName = $"IntegratedTestQueue_{Guid.NewGuid()}";

                await queueClient.EnsureQueueExistsAsync(queueName, autoDelete : true);

                await queueClient.PublishAsync("", queueName, "TestValue123");

                var receivedMessage = "";

                var worker = await AdvancedProcessingWorker <string> .CreateAndStartAsync(queueClient, queueName,
                                                                                          message => DoSomething(message, out receivedMessage), CancellationToken.None);

                const int timeLimit = 10000;

                var elapsedTime = 0;

                while (receivedMessage == "" && elapsedTime < timeLimit)
                {
                    await Task.Delay(100);

                    elapsedTime += 100;
                }

                worker.Stop();

                receivedMessage.ShouldBe("TestValue123");
            }
        }
        public async Task AdvancedCreateBatchPublishAndConsume()
        {
            var connectionFactory = CreateConnectionFactory();

            const int messageAmount = 100;

            var messages = GenerateMessages(messageAmount);

            using (var queueClient = new RabbitMQClient(connectionFactory))
            {
                var queueName = $"IntegratedTestQueue_{Guid.NewGuid()}";

                await queueClient.EnsureQueueExistsAsync(queueName);

                await queueClient.BatchPublishAsync("", queueName, messages);

                var receivedMessages = new ConcurrentBag <string>();

                var worker = await AdvancedProcessingWorker <string> .CreateAndStartAsync(queueClient, queueName,
                                                                                          message => BatchDoSomething(message, receivedMessages), CancellationToken.None);

                const int timeLimit = 10000;

                var elapsedTime = 0;

                while (receivedMessages.Count < messageAmount && elapsedTime < timeLimit)
                {
                    await Task.Delay(100);

                    elapsedTime += 100;
                }

                worker.Stop();

                await queueClient.QueueDeleteAsync(queueName);

                receivedMessages.Count.ShouldBe(messages.Count);
                receivedMessages.ShouldBeSubsetOf(messages);
            }
        }