public async Task OneTimeSetUp()
        {
            config = new Configuration.Configuration();

            endpointConfiguration = new EndpointConfiguration(config.EndpointName);
            var conventions = endpointConfiguration.Conventions();

            conventions.DefiningMessagesAs(type => type.IsAssignableFrom(typeof(PaymentMessage)));


            endpointConfiguration.UsePersistence <AzureStoragePersistence>()
            .ConnectionString(config.StorageConnectionString);
            endpointConfiguration.DisableFeature <TimeoutManager>();


            var transport = endpointConfiguration.UseTransport <AzureServiceBusTransport>();

            transport
            .ConnectionString(config.ServiceBusConnectionString)
            .Transactions(TransportTransactionMode.ReceiveOnly)
            .RuleNameShortener(ruleName => ruleName.Split('.').LastOrDefault() ?? ruleName);

            var routing = transport.Routing();

            routing.RouteToEndpoint(typeof(PaymentMessage), config.GetNSBServiceEndpointName());
            endpointConfiguration.UseSerialization <NewtonsoftSerializer>();
            endpointConfiguration.EnableInstallers();
            endpointConfiguration.SendOnly();
            endpointInstance = await Endpoint.Start(endpointConfiguration);
        }
        //[TestCase(100, 10, 1)]
        //[TestCase(100, 10, 2)]
        //[TestCase(100, 10, 3)]
        //[TestCase(100, 10, 4)]
        //[TestCase(100, 10, 5)]
        //[TestCase(100, 10, 6)]
        //[TestCase(100, 10, 7)]
        //[TestCase(100, 10, 8)]
        //[TestCase(100, 10, 9)]
        //[TestCase(100, 10, 10)]
        //[TestCase(500, 50, 11)]
        //[TestCase(500, 50, 12)]
        //[TestCase(500, 50, 13)]
        //[TestCase(500, 50, 14)]
        //[TestCase(500, 50, 15)]
        public async Task Time_For_NSB_To_Clear_Queue(int batchSize, int delayInSeconds, int testIndex)
        {
            Console.WriteLine($"Test: #{testIndex}, batch size: {batchSize}");
            var visibleTime = DateTime.UtcNow.AddSeconds(delayInSeconds);

            await SendMessages(batchSize, visibleTime).ConfigureAwait(false);

            var endTime = DateTime.Now.AddSeconds(delayInSeconds).Add(config.GetTimeToWait());

            Console.WriteLine($"Waiting until {endTime:G} for NSB service to finish storing the messages.");

            var connection = new ServiceBusConnection(config.ServiceBusConnectionString);
            var client     = new ManagementClient(config.ServiceBusConnectionString);

            while (DateTime.Now < endTime)
            {
                var queueInfo = await client.GetQueueRuntimeInfoAsync(config.GetNSBServiceEndpointName())
                                .ConfigureAwait(false);

                Console.WriteLine($"Time: {DateTime.Now:G}. Queue count: {queueInfo.MessageCount}, Active messages: {queueInfo.MessageCountDetails.ActiveMessageCount}, Dead letter: {queueInfo.MessageCountDetails.DeadLetterMessageCount}, Scheduled: {queueInfo.MessageCountDetails.ScheduledMessageCount}");
                if (DateTime.UtcNow > visibleTime && queueInfo.MessageCount == 0)
                {
                    var executionTime = DateTime.UtcNow - visibleTime;
                    Console.WriteLine($"Time: {DateTime.Now:G}. Took: {executionTime.TotalSeconds} seconds to clear {batchSize} messages");
                    Assert.Pass();
                }
                await Task.Delay(TimeSpan.FromMilliseconds(250));
            }
            Assert.Fail("Failed to process all messages.");
        }