Ejemplo n.º 1
0
        public void RegisterRefreshMiddleware_RegistersComponents()
        {
            // Arrange
            ContainerBuilder   containerBuilder = new ContainerBuilder();
            IConfigurationRoot config           = new ConfigurationBuilder().Build();

            // Act
            RefreshContainerBuilderExtensions.RegisterRefreshActuator(containerBuilder, config);
            var container = containerBuilder.Build();

            // Assert
            Assert.True(container.IsRegistered <IRefreshOptions>(), "Refresh options are registered");
            Assert.True(container.IsRegistered <IEndpoint <IList <string> > >(), "Refresh endpoint is registered");
            Assert.True(container.IsRegistered <EndpointOwinMiddleware <IList <string> > >(), "Refresh endpoint middleware is registered");
        }
Ejemplo n.º 2
0
        public void RegisterRefreshMiddleware_ThrowsOnNulls()
        {
            // Arrange
            ContainerBuilder   containerNull    = null;
            ContainerBuilder   containerBuilder = new ContainerBuilder();
            IConfigurationRoot configNull       = null;
            IConfigurationRoot config           = new ConfigurationBuilder().Build();

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

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