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

            // Act
            HeapDumpContainerBuilderExtensions.RegisterHeapDumpActuator(containerBuilder, config);
            var container = containerBuilder.Build();

            // Assert
            Assert.True(container.IsRegistered <IHeapDumpOptions>(), "HeapDump options are registered");
            Assert.True(container.IsRegistered <IHeapDumper>(), "HeapDumper is registered");
            Assert.True(container.IsRegistered <HeapDumpEndpoint>(), "HeapDump endpoint is registered");
            Assert.True(container.IsRegistered <HeapDumpEndpointOwinMiddleware>(), "Env endpoint middleware is registered");
        }
示例#2
0
        public void RegisterHeapDumpMiddleware_ThrowsOnNulls()
        {
            // Arrange
            ContainerBuilder   containerNull    = null;
            ContainerBuilder   containerBuilder = new ContainerBuilder();
            IConfigurationRoot configNull       = null;
            IConfigurationRoot config           = new ConfigurationBuilder().Build();

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

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