Repository: dotnet/aspnetcore
File: src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs (C#)

Code before:
        private readonly Func<IEnumerable<Assembly>> _getTestAssemblies;
        private readonly Action<HttpClient> _configureClient;

        public DelegatedWebApplicationFactory(
            WebApplicationFactoryClientOptions options,
            Func<IWebHostBuilder, TestServer> createServer,
            Func<IServiceProvider, TestServer> createServerFromServiceProvider,
            Func<IHostBuilder, IHost> createHost,
            Func<IWebHostBuilder?> createWebHostBuilder,
            Func<IHostBuilder?> createHostBuilder,
            Func<IEnumerable<Assembly>> getTestAssemblies,
            Action<HttpClient> configureClient,
            Action<IWebHostBuilder> configureWebHost)
        {
            ClientOptions = new WebApplicationFactoryClientOptions(options);
            _createServer = createServer;
            _createServerFromServiceProvider = createServerFromServiceProvider;
            _createHost = createHost;
            _createWebHostBuilder = createWebHostBuilder;
            _createHostBuilder = createHostBuilder;
            _getTestAssemblies = getTestAssemblies;
            _configureClient = configureClient;
            _configuration = configureWebHost;
        }

        [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead.")]
        protected override TestServer CreateServer(IWebHostBuilder builder) => _createServer(builder);

        protected override TestServer CreateServer(IServiceProvider serviceProvider) => _createServerFromServiceProvider(serviceProvider);

        protected override IHost CreateHost(IHostBuilder builder) => _createHost(builder);

        protected override IWebHostBuilder? CreateWebHostBuilder() => _createWebHostBuilder();

        protected override IHostBuilder? CreateHostBuilder() => _createHostBuilder();

        protected override IEnumerable<Assembly> GetTestAssemblies() => _getTestAssemblies();

        protected override void ConfigureWebHost(IWebHostBuilder builder) => _configuration(builder);

        protected override void ConfigureClient(HttpClient client) => _configureClient(client);

        internal override WebApplicationFactory<TEntryPoint> WithWebHostBuilderCore(Action<IWebHostBuilder> configuration)
        {
            return new DelegatedWebApplicationFactory(
                ClientOptions,
                _createServer,
                _createServerFromServiceProvider,
                _createHost,
                _createWebHostBuilder,
                _createHostBuilder,

Review comment (suggestion):
```suggestion
        [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead.", DiagnosticId = "ASPDEPR008")]
```

Code after:
        private readonly Func<IEnumerable<Assembly>> _getTestAssemblies;
        private readonly Action<HttpClient> _configureClient;

        public DelegatedWebApplicationFactory(
            WebApplicationFactoryClientOptions options,
            Func<IWebHostBuilder, TestServer> createServer,
            Func<IServiceProvider, TestServer> createServerFromServiceProvider,
            Func<IHostBuilder, IHost> createHost,
            Func<IWebHostBuilder?> createWebHostBuilder,
            Func<IHostBuilder?> createHostBuilder,
            Func<IEnumerable<Assembly>> getTestAssemblies,
            Action<HttpClient> configureClient,
            Action<IWebHostBuilder> configureWebHost)
        {
            ClientOptions = new WebApplicationFactoryClientOptions(options);
            _createServer = createServer;
            _createServerFromServiceProvider = createServerFromServiceProvider;
            _createHost = createHost;
            _createWebHostBuilder = createWebHostBuilder;
            _createHostBuilder = createHostBuilder;
            _getTestAssemblies = getTestAssemblies;
            _configureClient = configureClient;
            _configuration = configureWebHost;
        }

        [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead.", DiagnosticId = "ASPDEPR008")]
        protected override TestServer CreateServer(IWebHostBuilder builder) => _createServer(builder);

        protected override TestServer CreateServer(IServiceProvider serviceProvider) => _createServerFromServiceProvider(serviceProvider);

        protected override IHost CreateHost(IHostBuilder builder) => _createHost(builder);

        protected override IWebHostBuilder? CreateWebHostBuilder() => _createWebHostBuilder();

        protected override IHostBuilder? CreateHostBuilder() => _createHostBuilder();

        protected override IEnumerable<Assembly> GetTestAssemblies() => _getTestAssemblies();

        protected override void ConfigureWebHost(IWebHostBuilder builder) => _configuration(builder);

        protected override void ConfigureClient(HttpClient client) => _configureClient(client);

        internal override WebApplicationFactory<TEntryPoint> WithWebHostBuilderCore(Action<IWebHostBuilder> configuration)
        {
            return new DelegatedWebApplicationFactory(
                ClientOptions,
                _createServer,
                _createServerFromServiceProvider,
                _createHost,
                _createWebHostBuilder,
                _createHostBuilder,