Exemple #1
0
        public void RegisterRabbitMQConnection_Requires_Builder()
        {
            // arrange
            IConfiguration config = new ConfigurationBuilder().Build();

            // act & assert
            Assert.Throws <ArgumentNullException>(() => RabbitMQContainerBuilderExtensions.RegisterRabbitMQConnection(null, config));
        }
Exemple #2
0
        public void RegisterRabbitMQConnection_Requires_Config()
        {
            // arrange
            ContainerBuilder cb = new ContainerBuilder();

            // act & assert
            Assert.Throws <ArgumentNullException>(() => RabbitMQContainerBuilderExtensions.RegisterRabbitMQConnection(cb, null));
        }
Exemple #3
0
        public void RegisterRabbitMQConnection_AddsHealthContributorToContainer()
        {
            // arrange
            ContainerBuilder container = new ContainerBuilder();
            IConfiguration   config    = new ConfigurationBuilder().Build();

            // act
            var regBuilder        = RabbitMQContainerBuilderExtensions.RegisterRabbitMQConnection(container, config);
            var services          = container.Build();
            var healthContributor = services.Resolve <IHealthContributor>();

            // assert
            Assert.NotNull(healthContributor);
            Assert.IsType <RabbitMQHealthContributor>(healthContributor);
        }
Exemple #4
0
        public void RegisterRabbitMQConnection_AddsToContainer()
        {
            // arrange
            ContainerBuilder container = new ContainerBuilder();
            IConfiguration   config    = new ConfigurationBuilder().Build();

            // act
            var regBuilder       = RabbitMQContainerBuilderExtensions.RegisterRabbitMQConnection(container, config);
            var services         = container.Build();
            var rabbitMQIFactory = services.Resolve <IConnectionFactory>();
            var rabbitMQFactory  = services.Resolve <ConnectionFactory>();

            // assert
            Assert.NotNull(rabbitMQIFactory);
            Assert.NotNull(rabbitMQFactory);
            Assert.IsType <ConnectionFactory>(rabbitMQIFactory);
            Assert.IsType <ConnectionFactory>(rabbitMQFactory);
        }