Soenneker.Fixtures.Integration
4.0.675
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Fixtures.Integration --version 4.0.675
NuGet\Install-Package Soenneker.Fixtures.Integration -Version 4.0.675
<PackageReference Include="Soenneker.Fixtures.Integration" Version="4.0.675" />
<PackageVersion Include="Soenneker.Fixtures.Integration" Version="4.0.675" />
<PackageReference Include="Soenneker.Fixtures.Integration" />
paket add Soenneker.Fixtures.Integration --version 4.0.675
#r "nuget: Soenneker.Fixtures.Integration, 4.0.675"
#:package Soenneker.Fixtures.Integration@4.0.675
#addin nuget:?package=Soenneker.Fixtures.Integration&version=4.0.675
#tool nuget:?package=Soenneker.Fixtures.Integration&version=4.0.675
Soenneker.Fixtures.Integration
A reusable xUnit fixture for lazily creating multiple authenticated ASP.NET Core WebApplicationFactory<T> instances with test logging and Bogus data generation.
Installation
dotnet add package Soenneker.Fixtures.Integration
Define a fixture
public sealed class ApiFixture : IntegrationFixture
{
public ApiFixture()
{
RegisterFactory<Program>("net10.0");
}
}
[CollectionDefinition("API")]
public sealed class ApiCollection : ICollectionFixture<ApiFixture>;
projectName identifies the directory directly beneath the parent of AppContext.BaseDirectory that contains appsettings.json. For a typical test output at bin/Debug/net10.0, passing net10.0 loads the copied bin/Debug/net10.0/appsettings.json. The resolved path must stay beneath that parent directory.
Register each startup type once. Repeated concurrent registrations for the same TStartup are safe; the first project name wins.
Use a factory
[Collection("API")]
public sealed class AccountTests(ApiFixture fixture)
{
[Fact]
public async Task Gets_account()
{
WebApplicationFactory<Program> factory = fixture.GetFactory<Program>().Value;
using HttpClient client = factory.CreateClient();
HttpResponseMessage response = await client.GetAsync("/api/account");
response.EnsureSuccessStatusCode();
}
}
Factories are lazy: registration does not start an application, and fixture disposal skips factories that were never created. Asking for an unregistered startup type throws InvalidOperationException.
Test host behavior
Each created factory:
- Adds the selected
appsettings.jsonwithout file watching. - Registers the JWT utility and integration-test startup filter.
- Sets the default authentication scheme to
Testand installsTestAuthHandler. - Sends verbose Serilog events to the injectable xUnit output sink.
The test authentication handler is for in-memory integration hosts only. Do not copy it into production service registration. Verbose test logs can contain application data, so avoid real credentials and production personal data in test configuration and requests.
Generated data
After xUnit calls InitializeAsync(), Faker and AutoFaker are available. A derived fixture can assign AutoFakerConfig before initialization to customize generation. Factory instances and generated-data helpers are shared according to the xUnit fixture lifetime, so tests should not mutate shared configuration after use begins.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Mvc.Testing (>= 10.0.11)
- Serilog.AspNetCore (>= 10.0.0)
- Serilog.Sinks.Async (>= 2.1.0)
- Serilog.Sinks.XUnit.Injectable (>= 4.0.256)
- Soenneker.Enums.DeployEnvironment (>= 4.0.236)
- Soenneker.StartupFilters.IntegrationTests (>= 4.0.121)
- Soenneker.Utils.AutoBogus (>= 4.0.938)
- Soenneker.Utils.Test.AuthHandler (>= 4.0.335)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.681 | 0 | 9/2/2026 |
| 4.0.680 | 46 | 9/2/2026 |
| 4.0.679 | 31 | 9/2/2026 |
| 4.0.678 | 30 | 9/1/2026 |
| 4.0.677 | 38 | 9/1/2026 |
| 4.0.676 | 46 | 8/31/2026 |
| 4.0.675 | 48 | 8/31/2026 |
| 4.0.674 | 52 | 8/31/2026 |
| 4.0.672 | 51 | 8/31/2026 |
| 4.0.671 | 41 | 8/31/2026 |
| 4.0.669 | 46 | 8/30/2026 |
| 4.0.667 | 53 | 8/30/2026 |
| 4.0.665 | 52 | 8/30/2026 |
| 4.0.664 | 46 | 8/30/2026 |
| 4.0.663 | 64 | 8/30/2026 |
| 4.0.661 | 53 | 8/30/2026 |
| 4.0.659 | 42 | 8/30/2026 |
| 4.0.658 | 65 | 8/30/2026 |
| 4.0.656 | 56 | 8/29/2026 |
| 4.0.654 | 46 | 8/29/2026 |
Update dependency Soenneker.Utils.Test.AuthHandler to 4.0.335 (#1192)