public DependencyInjectionExtensionsTests()
        {
            _services = new ServiceCollection();

            _services.AddBus();

            _testSubscriber = new TestSubscriber();
            _services.AddSingleton <ISubscriber>(_testSubscriber);

            _services.AddSingleton <ILoggerFactory, NullLoggerFactory>();
            _services.AddSingleton(typeof(ILogger <>), typeof(NullLogger <>));

            _serviceProvider = null; // Creation deferred to after AddBroker() has been called
            _serviceScope    = null;

            InMemoryInboundLog.Clear();
            InMemoryOutboundQueue.Clear();
        }
        public LoggedInboundConnectorTests()
        {
            var services = new ServiceCollection();

            _testSubscriber = new TestSubscriber();

            services.AddSingleton <ILoggerFactory, NullLoggerFactory>();
            services.AddSingleton(typeof(ILogger <>), typeof(NullLogger <>));
            services
            .AddSilverback()
            .WithConnectionTo <TestBroker>()
            .AddSingletonSubscriber(_testSubscriber);

            services.AddScoped <IInboundLog, InMemoryInboundLog>();

            _serviceProvider = services.BuildServiceProvider();
            _broker          = (TestBroker)_serviceProvider.GetService <IBroker>();
            _connector       = new LoggedInboundConnector(_broker, _serviceProvider, new NullLogger <LoggedInboundConnector>(),
                                                          new MessageLogger());

            InMemoryInboundLog.Clear();
        }
Пример #3
0
        public LoggedInboundConnectorTests()
        {
            var services = new ServiceCollection();

            _testSubscriber = new TestSubscriber();
            services.AddSingleton <ISubscriber>(_testSubscriber);

            services.AddSingleton <ILoggerFactory, NullLoggerFactory>();
            services.AddSingleton(typeof(ILogger <>), typeof(NullLogger <>));
            services.AddBus();

            services.AddBroker <TestBroker>();

            services.AddScoped <IInboundLog, InMemoryInboundLog>();

            _serviceProvider = services.BuildServiceProvider();
            _broker          = (TestBroker)_serviceProvider.GetService <IBroker>();
            _connector       = new LoggedInboundConnector(_broker, _serviceProvider, new NullLogger <LoggedInboundConnector>(),
                                                          new MessageLogger(new MessageKeyProvider(new[] { new DefaultPropertiesMessageKeyProvider() })));

            InMemoryInboundLog.Clear();
        }
Пример #4
0
 public InMemoryInboundLogTests()
 {
     _log = new InMemoryInboundLog(new MessageKeyProvider(new [] { new DefaultPropertiesMessageKeyProvider() }));
     InMemoryInboundLog.Clear();
 }