public async Task ItShouldGoBangQuickly()
        {
            var typeProvider = new TestHarnessTypeProvider(new[] {GetType().Assembly}, new[] {GetType().Namespace});

            var logger = TestHarnessLoggerFactory.Create();

            var bus = new BusBuilder().Configure()
                                      .WithDefaults(typeProvider)
                                      .WithTransport(new WindowsServiceBusTransportConfiguration()
                                                         .WithConnectionString(
                                                             @"Endpoint=sb://shouldnotexist.example.com/;SharedAccessKeyName=IntegrationTestHarness;SharedAccessKey=borkborkbork=")
                )
                                      .WithNames("IntegrationTestHarness", Environment.MachineName)
                                      .WithDefaultTimeout(TimeSpan.FromSeconds(TimeoutSeconds))
                                      .WithLogger(logger)
                                      .Build();

            try
            {
                await bus.Start();
                Assert.Fail();
            }
            catch (Exception e)
            {
                e.ShouldBeTypeOf<BusException>();
            }
        }
        private async Task ClearMeABus(IConfigurationScenario<TransportConfiguration> scenario)
        {
            using (var instance = scenario.CreateInstance())
            {
                // We want a namespace that doesn't exist here so that all the queues and topics are removed.
                var typeProvider = new TestHarnessTypeProvider(new[] {GetType().Assembly}, new[] {"Some.Namespace.That.Does.Not.Exist"});
                var transportConfiguration = instance.Configuration;

                var busBuilder = new BusBuilder().Configure()
                                                 .WithTransport(transportConfiguration)
                                                 .WithRouter(new DestinationPerMessageTypeRouter())
                                                 .WithSerializer(new JsonSerializer())
                                                 .WithDeliveryRetryStrategy(new ImmediateRetryDeliveryStrategy())
                                                 .WithDependencyResolver(new DependencyResolver(typeProvider))
                                                 .WithNames("MyTestSuite", Environment.MachineName)
                                                 .WithTypesFrom(typeProvider)
                                                 .WithDefaultTimeout(TimeSpan.FromSeconds(TimeoutSeconds))
                                                 .WithHeartbeatInterval(TimeSpan.MaxValue)
                                                 .WithLogger(_logger)
                                                 .WithDebugOptions(
                                                     dc =>
                                                         dc.RemoveAllExistingNamespaceElementsOnStartup(
                                                             "I understand this will delete EVERYTHING in my namespace. I promise to only use this for test suites."))
                    ;

                using (var bus = busBuilder.Build())
                {
                    await bus.Start();
                    await bus.Stop();
                }
            }
        }
        private async Task<Bus> BuildMeABus(IConfigurationScenario<TransportConfiguration> scenario)
        {
            var typeProvider = new TestHarnessTypeProvider(new[] {GetType().Assembly}, new[] {GetType().Namespace});

            using (var instance = scenario.CreateInstance())
            {
                var transportConfiguration = instance.Configuration;

                var configuration = new BusBuilder().Configure()
                                                    .WithTransport(transportConfiguration)
                                                    .WithRouter(new DestinationPerMessageTypeRouter())
                                                    .WithSerializer(new JsonSerializer())
                                                    .WithDeliveryRetryStrategy(new ImmediateRetryDeliveryStrategy())
                                                    .WithDependencyResolver(new DependencyResolver(typeProvider))
                                                    .WithNames("MyTestSuite", Environment.MachineName)
                                                    .WithTypesFrom(typeProvider)
                                                    .WithDefaultTimeout(TimeSpan.FromSeconds(10))
                                                    .WithHeartbeatInterval(TimeSpan.MaxValue)
                                                    .WithLogger(_logger)
                    ;

                var bus = configuration.Build();
                await bus.Start();
                await bus.Stop();
                return bus;
            }
        }
 protected async Task<BrokeredMessageFactory> Given()
 {
     var typeProvider = new TestHarnessTypeProvider(new[] {GetType().Assembly}, new[] {GetType().Namespace});
     return new BrokeredMessageFactory(
         new MaxLargeMessageSizeSetting(),
         new MaxSmallMessageSizeSetting {Value = 64*1024},
         new SystemClock(),
         new NullCompressor(),
         new DispatchContextManager(),
         new UnsupportedLargeMessageBodyStore(),
         new DataContractSerializer(typeProvider),
         typeProvider);
 }