Repository: dotnet/aspnetcore
File: src/Hosting/TestHost/src/WebHostBuilderExtensions.cs (C#)

Code before:
            services.AddSingleton<IServer, TestServer>();
        });
    }

    /// <summary>
    /// Enables the <see cref="TestServer" /> service.
    /// </summary>
    /// <param name="builder">The <see cref="IWebHostBuilder"/>.</param>
    /// <param name="configureOptions">Configures test server options</param>
    /// <returns>The <see cref="IWebHostBuilder"/>.</returns>
    public static IWebHostBuilder UseTestServer(this IWebHostBuilder builder, Action<TestServerOptions> configureOptions)
    {
        return builder.ConfigureServices(services =>
        {
            services.Configure(configureOptions);
            services.AddSingleton<IHostLifetime, NoopHostLifetime>();
            services.AddSingleton<IServer, TestServer>();
        });
    }

    /// <summary>
    /// Retrieves the TestServer from the host services.
    /// </summary>
    /// <param name="host"></param>
    /// <returns></returns>
    [Obsolete("IWebHost is obsolete. Use IHost instead.", DiagnosticId = "ASPDEPR008")]
    public static TestServer GetTestServer(this IWebHost host)
    {
        return (TestServer)host.Services.GetRequiredService<IServer>();
    }

    /// <summary>
    /// Retrieves the test client from the TestServer in the host services.
    /// </summary>
    /// <param name="host"></param>
    /// <returns></returns>
    [Obsolete("IWebHost is obsolete. Use IHost instead.", DiagnosticId = "ASPDEPR008")]
    public static HttpClient GetTestClient(this IWebHost host)
    {
        return host.GetTestServer().CreateClient();
    }

    /// <summary>
    /// Configures the <see cref="IWebHostBuilder" /> instance with the services provided in <paramref name="servicesConfiguration" />.
    /// </summary>
    /// <param name="webHostBuilder">The <see cref="IWebHostBuilder"/>.</param>
    /// <param name="servicesConfiguration">An <see cref="Action"/> that registers services onto the <see cref="IServiceCollection"/>.</param>
    /// <returns>The <see cref="IWebHostBuilder"/>.</returns>
    public static IWebHostBuilder ConfigureTestServices(this IWebHostBuilder webHostBuilder, Action<IServiceCollection> servicesConfiguration)
    {
        ArgumentNullException.ThrowIfNull(webHostBuilder);

Review comment (suggestion):
```suggestion
    [Obsolete("IWebHost is obsolete. Use IHost instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId = "ASPDEPR008")]
```

Code after:
            services.AddSingleton<IServer, TestServer>();
        });
    }

    /// <summary>
    /// Enables the <see cref="TestServer" /> service.
    /// </summary>
    /// <param name="builder">The <see cref="IWebHostBuilder"/>.</param>
    /// <param name="configureOptions">Configures test server options</param>
    /// <returns>The <see cref="IWebHostBuilder"/>.</returns>
    public static IWebHostBuilder UseTestServer(this IWebHostBuilder builder, Action<TestServerOptions> configureOptions)
    {
        return builder.ConfigureServices(services =>
        {
            services.Configure(configureOptions);
            services.AddSingleton<IHostLifetime, NoopHostLifetime>();
            services.AddSingleton<IServer, TestServer>();
        });
    }

    /// <summary>
    /// Retrieves the TestServer from the host services.
    /// </summary>
    /// <param name="host"></param>
    /// <returns></returns>
    [Obsolete("IWebHost is obsolete. Use IHost instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId = "ASPDEPR008")]
    public static TestServer GetTestServer(this IWebHost host)
    {
        return (TestServer)host.Services.GetRequiredService<IServer>();
    }

    /// <summary>
    /// Retrieves the test client from the TestServer in the host services.
    /// </summary>
    /// <param name="host"></param>
    /// <returns></returns>
    [Obsolete("IWebHost is obsolete. Use IHost instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId = "ASPDEPR008")]
    public static HttpClient GetTestClient(this IWebHost host)
    {
        return host.GetTestServer().CreateClient();
    }

    /// <summary>
    /// Configures the <see cref="IWebHostBuilder" /> instance with the services provided in <paramref name="servicesConfiguration" />.
    /// </summary>
    /// <param name="webHostBuilder">The <see cref="IWebHostBuilder"/>.</param>
    /// <param name="servicesConfiguration">An <see cref="Action"/> that registers services onto the <see cref="IServiceCollection"/>.</param>
    /// <returns>The <see cref="IWebHostBuilder"/>.</returns>
    public static IWebHostBuilder ConfigureTestServices(this IWebHostBuilder webHostBuilder, Action<IServiceCollection> servicesConfiguration)
    {
        ArgumentNullException.ThrowIfNull(webHostBuilder);