Example #1
0
        public void RegisterInfoMiddleware_RegistersComponents()
        {
            // Arrange
            ContainerBuilder   containerBuilder = new ContainerBuilder();
            IConfigurationRoot config           = new ConfigurationBuilder().Build();

            // Act
            InfoContainerBuilderExtensions.RegisterInfoActuator(containerBuilder, config);
            var container = containerBuilder.Build();

            // Assert
            Assert.True(container.IsRegistered <IInfoOptions>(), "Info options are registered");
            Assert.True(container.IsRegistered <IInfoContributor>(), "At least one Info contributor registered");
            Assert.True(container.IsRegistered <IEndpoint <Dictionary <string, object> > >(), "Info endpoint is registered");
            Assert.True(container.IsRegistered <EndpointOwinMiddleware <Dictionary <string, object> > >(), "Env endpoint middleware is registered");
        }
Example #2
0
        public void RegisterInfoMiddleware_ThrowsOnNulls()
        {
            // Arrange
            ContainerBuilder   containerNull    = null;
            ContainerBuilder   containerBuilder = new ContainerBuilder();
            IConfigurationRoot configNull       = null;
            IConfigurationRoot config           = new ConfigurationBuilder().Build();

            // Act
            var ex  = Assert.Throws <ArgumentNullException>(() => InfoContainerBuilderExtensions.RegisterInfoActuator(containerNull, config));
            var ex2 = Assert.Throws <ArgumentNullException>(() => InfoContainerBuilderExtensions.RegisterInfoActuator(containerBuilder, configNull));

            // Assert
            Assert.Equal("container", ex.ParamName);
            Assert.Equal("config", ex2.ParamName);
        }