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

Code before:
    /// </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.", 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>
    /// Gets or sets the base address associated with the HttpClient returned by the test server. Defaults to http://localhost/.
    /// </summary>
    public Uri BaseAddress { get; set; } = new Uri("http://localhost/");

    /// <summary>
    /// Gets the <see cref="IWebHost" /> instance associated with the test server.
    /// </summary>
    [Obsolete("IWebHost is obsolete. Use IHost instead.", DiagnosticId = "ASPDEPR008")]
    public IWebHost Host
    {
        get
        {
            return _hostInstance
                ?? throw new InvalidOperationException("The TestServer constructor was not called with a IWebHostBuilder so IWebHost is not available.");
        }
    }

    /// <summary>
    /// Gets the service provider associated with the test server.
    /// </summary>
    public IServiceProvider Services { get; }

    /// <summary>
    /// Gets the collection of server features associated with the test server.
    /// </summary>
    public IFeatureCollection Features { get; }

    /// <summary>
    /// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>. The default value is <see langword="false" />.
    /// </summary>
    public bool AllowSynchronousIO { get; set; }

    /// <summary>

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:
    /// </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>
    /// Gets or sets the base address associated with the HttpClient returned by the test server. Defaults to http://localhost/.
    /// </summary>
    public Uri BaseAddress { get; set; } = new Uri("http://localhost/");

    /// <summary>
    /// Gets the <see cref="IWebHost" /> instance associated with the test server.
    /// </summary>
    [Obsolete("IWebHost is obsolete. Use IHost instead. For more information, visit https://aka.ms/aspnet/deprecate/008.", DiagnosticId = "ASPDEPR008")]
    public IWebHost Host
    {
        get
        {
            return _hostInstance
                ?? throw new InvalidOperationException("The TestServer constructor was not called with a IWebHostBuilder so IWebHost is not available.");
        }
    }

    /// <summary>
    /// Gets the service provider associated with the test server.
    /// </summary>
    public IServiceProvider Services { get; }

    /// <summary>
    /// Gets the collection of server features associated with the test server.
    /// </summary>
    public IFeatureCollection Features { get; }

    /// <summary>
    /// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>. The default value is <see langword="false" />.
    /// </summary>
    public bool AllowSynchronousIO { get; set; }

    /// <summary>