Soenneker.Fixtures.Integration 4.0.675

Prefix Reserved
There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Fixtures.Integration" Version="4.0.675" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Fixtures.Integration" Version="4.0.675" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Fixtures.Integration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Fixtures.Integration --version 4.0.675
                    
#r "nuget: Soenneker.Fixtures.Integration, 4.0.675"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Fixtures.Integration@4.0.675
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Fixtures.Integration&version=4.0.675
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Fixtures.Integration&version=4.0.675
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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.json without file watching.
  • Registers the JWT utility and integration-test startup filter.
  • Sets the default authentication scheme to Test and installs TestAuthHandler.
  • 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed

Update dependency Soenneker.Utils.Test.AuthHandler to 4.0.335 (#1192)