public async Task FailsSilentlyWhenAnErrorOccursBuildingAQueueClient()
        {
            var composer = new ServiceBusComposer();

            composer.OverrideQueueClientFactory(new FailingQueueClientFactory());
            composer.WithAdditionalServices(
                services =>
            {
                services.ConfigureServiceBus(
                    options =>
                {
                    options.RegisterQueue("testQueue").WithConnectionString("testConnectionString");
                });
            });

            var provider = await composer.ComposeAndSimulateStartup();

            var registry = provider.GetService <ServiceBusRegistry>();

            await Assert.ThrowsAsync <MessageSenderUnavailableException>(
                async() =>
            {
                await registry.GetQueueSender("testQueue").SendAsync(new Message());
            });
        }
        public async Task DoesntThrowExceptionWhenServiceBusIsDeactivated()
        {
            var services = new ServiceCollection();

            services.AddLogging();
            services.AddServiceBus(false);
            services.ConfigureServiceBus(
                options =>
            {
                options.RegisterQueue("testQueue").WithConnectionString("testConnectionString");
            });

            var provider = services.BuildServiceProvider();
            await provider.SimulateStartHost(token : new CancellationToken());

            var composer = new ServiceBusComposer();

            composer.OverrideQueueClientFactory(new FailingQueueClientFactory());

            var registry = provider.GetService <ServiceBusRegistry>();
            await registry.GetQueueSender("testQueue").SendAsync(new Message());
        }