Ejemplo n.º 1
0
        public void QueryFactoryProviders_with_same_name_are_processed_correctly(IQueueFactoryProvider[] providers, IConnectionFactoryProviders connectionFactoryProviders, string providerName, ILogger <ConfigurationFactory> logger)
        {
            foreach (var provider in providers)
            {
                Mock.Get(provider).SetupGet(p => p.ProviderName).Returns(providerName);
            }

            var factory = new ConfigurationFactory(providers, connectionFactoryProviders, logger);
        }
Ejemplo n.º 2
0
 public void Logger_is_required(IQueueFactoryProvider[] providers, IConnectionFactoryProviders connectionFactoryProviders)
 {
     Assert.Throws <ArgumentNullException>(() => new ConfigurationFactory(providers, connectionFactoryProviders, null));
 }
Ejemplo n.º 3
0
        public void Create_uses_ConnectionStringConnectionFactory_when_connectionString_is_provided([Frozen] IConnectionFactoryProviders providers, ConfigurationFactory sut, RabbitMqOptions options, string connectionString)
        {
            Mock.Get(options.ConnectionString).SetupGet(p => p.Value).Returns(connectionString);

            options.Connection = null;

            var configuration = sut.Create(options);

            Mock.Get(providers.ConnectionString).Verify(p => p.CreateFactory(options.ConnectionString), Times.Once);
        }
Ejemplo n.º 4
0
        public void Create_uses_ConnectionNodeConnectionFactory_when_connection_settings_are_provided([Frozen] IConnectionFactoryProviders providers, ConfigurationFactory sut, RabbitMqOptions options, string connectionString)
        {
            options.ConnectionString = null;

            var configuration = sut.Create(options);

            Mock.Get(providers.ConnectionNode).Verify(p => p.CreateFactory(options.Connection), Times.Once);
        }
Ejemplo n.º 5
0
 public ConfigurationFactory(IEnumerable <IQueueFactoryProvider> queueFactoryProviders, IConnectionFactoryProviders connectionFactoryProviders, ILogger <ConfigurationFactory> logger)
 {
     _connectionFactoryProviders = connectionFactoryProviders ?? throw new ArgumentNullException(nameof(connectionFactoryProviders));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _queueFactoryProviders = CreateDictionary(queueFactoryProviders ?? throw new ArgumentNullException(nameof(queueFactoryProviders)));
 }