Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions aspnetcore/test/integration-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,22 @@ There are various ways to supply test-specific configurations to the running web

Using this approach, the configuration source added via `ConfigureAppConfiguration` is preserved, but it's only available after the web application is built. If you try to access the configuration before `WebApplicationBuilder.Build` is called, the configurations will not be available.

3. Starting in .NET 11 Preview 6, you can override a new `ConfigureHostApplicationBuilder` method as follows:
3. Starting in .NET 11 Preview 7, you can override a new `ConfigureWebApplicationBuilder` method as follows:

```csharp
private static readonly KeyValuePair<string, string?>[] s_inMemorySettings = new KeyValuePair<string, string?>[]
{
new("TestConfigKey", "TestConfigValue"),
};

protected override void ConfigureHostApplicationBuilder(IHostApplicationBuilder hostApplicationBuilder)
protected override void ConfigureWebApplicationBuilder(IHostApplicationBuilder hostApplicationBuilder)
{
hostApplicationBuilder.Configuration.AddInMemoryCollection(s_inMemorySettings);
base.ConfigureHostApplicationBuilder(hostApplicationBuilder);
base.ConfigureWebApplicationBuilder(hostApplicationBuilder);
}
```

Using this approach, the configuration source added via `ConfigureHostApplicationBuilder` is preserved, and is also available immediately after `WebApplication.CreateBuilder` returns.
Using this approach, the configuration source added via `ConfigureWebApplicationBuilder` is preserved, and is also available immediately after `WebApplication.CreateBuilder` returns.

## Customize the client with WithWebHostBuilder

Expand Down
Loading