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

Code before:
    {
        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);
        ArgumentNullException.ThrowIfNull(servicesConfiguration);

        if (webHostBuilder.GetType().Name.Equals("GenericWebHostBuilder", StringComparison.Ordinal))
        {
            // Generic host doesn't need to do anything special here since there's only one container.
            webHostBuilder.ConfigureServices(servicesConfiguration);
        }
        else
        {
#pragma warning disable CS0612 // Type or member is obsolete
            webHostBuilder.ConfigureServices(

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:
    {
        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);
        ArgumentNullException.ThrowIfNull(servicesConfiguration);

        if (webHostBuilder.GetType().Name.Equals("GenericWebHostBuilder", StringComparison.Ordinal))
        {
            // Generic host doesn't need to do anything special here since there's only one container.
            webHostBuilder.ConfigureServices(servicesConfiguration);
        }
        else
        {
#pragma warning disable CS0612 // Type or member is obsolete
            webHostBuilder.ConfigureServices(