public static IAppContainer Create(MockAppHostPlugin hostPlugin, IServiceCollection services) { var resolver = new TestTypeResolver(); resolver.AddPlugin(hostPlugin); var container = ContainerSetup.Bootstrap(resolver); container.WithConfig((EnvironmentConfig envConfig) => { var configBuilder = new ConfigurationBuilder(); configBuilder.AddDefaultAppSettings(); envConfig.UseConfiguration(configBuilder.Build()); }) .WithConfig((AutofacRegistrationConfig config) => { config.Build = builder => { builder.Populate(services); }; }) .WithConfig((WebMvcConfig config) => { config.EnableRouteMetadata = true; config.UseServices(services); }); return(container); }