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

Code before:
    /// <summary>
    /// For use with IHostBuilder.
    /// </summary>
    /// <param name="services"></param>
    public TestServer(IServiceProvider services)
        : this(services, CreateTestFeatureCollection())
    {
    }

    /// <summary>
    /// For use with IHostBuilder.
    /// </summary>
    /// <param name="services"></param>
    /// <param name="featureCollection"></param>
    public TestServer(IServiceProvider services, IFeatureCollection featureCollection)
        : this(services, featureCollection, Options.Create(new TestServerOptions()))
    {
        Services = services ?? throw new ArgumentNullException(nameof(services));
        Features = featureCollection ?? throw new ArgumentNullException(nameof(featureCollection));
    }

    /// <summary>
    /// For use with IWebHostBuilder.
    /// </summary>
    /// <param name="builder"></param>
    [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead.")]
    public TestServer(IWebHostBuilder builder)
        : this(builder, CreateTestFeatureCollection())
    {
    }

    /// <summary>
    /// For use with IWebHostBuilder.
    /// </summary>
    /// <param name="builder"></param>
    /// <param name="featureCollection"></param>
    [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead.")]
    public TestServer(IWebHostBuilder builder, IFeatureCollection featureCollection)
    {
        ArgumentNullException.ThrowIfNull(builder);

        Features = featureCollection ?? throw new ArgumentNullException(nameof(featureCollection));

        var host = builder.UseServer(this).Build();
        host.StartAsync().GetAwaiter().GetResult();
        _hostInstance = host;

        Services = host.Services;
    }

    /// <summary>

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:
    /// <summary>
    /// For use with IHostBuilder.
    /// </summary>
    /// <param name="services"></param>
    public TestServer(IServiceProvider services)
        : this(services, CreateTestFeatureCollection())
    {
    }

    /// <summary>
    /// For use with IHostBuilder.
    /// </summary>
    /// <param name="services"></param>
    /// <param name="featureCollection"></param>
    public TestServer(IServiceProvider services, IFeatureCollection featureCollection)
        : this(services, featureCollection, Options.Create(new TestServerOptions()))
    {
        Services = services ?? throw new ArgumentNullException(nameof(services));
        Features = featureCollection ?? throw new ArgumentNullException(nameof(featureCollection));
    }

    /// <summary>
    /// For use with IWebHostBuilder.
    /// </summary>
    /// <param name="builder"></param>
    [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId = "ASPDEPR008")]
    public TestServer(IWebHostBuilder builder)
        : this(builder, CreateTestFeatureCollection())
    {
    }

    /// <summary>
    /// For use with IWebHostBuilder.
    /// </summary>
    /// <param name="builder"></param>
    /// <param name="featureCollection"></param>
    [Obsolete("IWebHost, which this method uses, is obsolete. Use one of the ctors that takes an IServiceProvider instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId = "ASPDEPR008")]
    public TestServer(IWebHostBuilder builder, IFeatureCollection featureCollection)
    {
        ArgumentNullException.ThrowIfNull(builder);

        Features = featureCollection ?? throw new ArgumentNullException(nameof(featureCollection));

        var host = builder.UseServer(this).Build();
        host.StartAsync().GetAwaiter().GetResult();
        _hostInstance = host;

        Services = host.Services;
    }

    /// <summary>