private void BuildMeABus() { // Filter types we care about to only our own test's namespace. It's a performance optimisation because creating and // deleting queues and topics is slow. var typeProvider = new TestHarnessTypeProvider(new[] {GetType().Assembly}, new[] {GetType().Namespace}); var messageBroker = new DefaultMessageBroker(typeProvider); var logger = new ConsoleLogger(); var bus = new BusBuilder().Configure() .WithNames("MyTestSuite", Environment.MachineName) .WithConnectionString(CommonResources.ConnectionString) .WithTypesFrom(typeProvider) .WithCommandBroker(messageBroker) .WithRequestBroker(messageBroker) .WithMulticastEventBroker(messageBroker) .WithCompetingEventBroker(messageBroker) .WithMulticastRequestBroker(messageBroker) .WithDefaultTimeout(TimeSpan.FromSeconds(10)) .WithLogger(logger) .Build(); bus.ShouldNotBe(null); }
private Task<Bus> BuildMeABus() { return Task.Run(async () => { // Filter types we care about to only our own test's namespace. It's a performance optimisation because creating and // deleting queues and topics is slow. var typeProvider = new TestHarnessTypeProvider(new[] {GetType().Assembly}, new[] {GetType().Namespace}); var logger = TestHarnessLoggerFactory.Create(); var bus = new BusBuilder().Configure() .WithNames("IntegrationTestHarness", Environment.MachineName) .WithConnectionString(CommonResources.ServiceBusConnectionString) .WithTypesFrom(typeProvider) .WithDefaultTimeout(TimeSpan.FromSeconds(10)) .WithLogger(logger) .Build(); bus.ShouldNotBe(null); await bus.Start(); return bus; }); }