public void Setup(IMessagingConfiguration config, bool deleteDb = true) { if (config == null) { config = TestMessagingConfiguration.Create(); } var containerBuilder = new ContainerBuilder(); var serviceProvider = new ServiceCollection(); var configurator = new QueueConfigurator(serviceProvider, GetRegistrator()); configurator .SetConfigurationProvider(config) .SetTopicProvider <TestTopicNameProvider>() .RegisterHandler <TestHandler>() .RegisterHandler <SlightlyDifferentTestHandler>() .RegisterHandler <AlwaysErrorHandler>() .RegisterHandler <ResendHandler>() .RegisterHandler <TransactionResendHandler>() .RegisterHandler <TimeConsumingHandler>(); serviceProvider.AddSingleton(configurator); serviceProvider.AddSingleton <IInstanceResolver, ServiceProviderResolver>(); containerBuilder.Populate(serviceProvider); var container = containerBuilder.Build(); Resolver = container.Resolve <IInstanceResolver>(); Builder = configurator.Build(Resolver); if (deleteDb) { ClearDb(); } }
public void Setup() { var autofacRegistrator = new AutofacRegistrator(); var configurator = new QueueConfigurator(autofacRegistrator, GetRegistrtor()); configurator .SetConfigurationProvider(TestMessagingConfiguration.Create()) .SetTopicProvider <TestTopicNameProvider>() .RegisterHandler <TestHandler>() .RegisterHandler <SlightlyDifferentTestHandler>() .RegisterHandler <ResendHandler>() .RegisterHandler <TimeConsumingHandler>(); Resolver = autofacRegistrator.CreateResolver(); Builder = configurator.Build(Resolver); ClearDb(); }