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

            // Act
            TraceContainerBuilderExtensions.RegisterTraceActuator(containerBuilder, config);
            var container = containerBuilder.Build();

            // Assert
            Assert.True(container.IsRegistered <ITraceOptions>(), "Trace options are registered");
            Assert.True(container.IsRegistered <ITraceRepository>(), "ITraceRepository is registered");
            Assert.True(container.IsRegistered <IEndpoint <List <TraceResult> > >(), "Trace endpoint is registered");
            Assert.True(container.IsRegistered <EndpointOwinMiddleware <List <TraceResult> > >(), "Trace endpoint middleware is registered");
        }
Esempio n. 2
0
        public void RegisterTraceMiddleware_ThrowsOnNulls()
        {
            // Arrange
            ContainerBuilder   containerNull    = null;
            ContainerBuilder   containerBuilder = new ContainerBuilder();
            IConfigurationRoot configNull       = null;
            IConfigurationRoot config           = new ConfigurationBuilder().Build();

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

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