public void GenerateAllAutofacMiddleware_CreatesRegisteredMiddleware()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <TestMiddleware>();
            var container = builder.Build();

            var middlewareTypes = AutofacAppBuilderExtensions.GenerateAllAutofacMiddleware(container);

            Assert.Equal(1, middlewareTypes.Count());
            Assert.Contains(typeof(AutofacMiddleware <TestMiddleware>), middlewareTypes);
        }
Exemplo n.º 2
0
        public void GenerateAllAutofacMiddleware_CreatesOnlyRegisteredMiddlewareWithACTNARS()
        {
            // Issue #9: ACTNARS causes the list of registered middleware to fail during generation.
            var builder = new ContainerBuilder();

            builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
            builder.RegisterType <TestMiddleware>();
            var container = builder.Build();

            var middlewareTypes = AutofacAppBuilderExtensions.GenerateAllAutofacMiddleware(container);

            Assert.Equal(1, middlewareTypes.Count());
            Assert.Contains(typeof(AutofacMiddleware <TestMiddleware>), middlewareTypes);
        }