Soenneker.Tests.Integration 4.0.911

Prefix Reserved
dotnet add package Soenneker.Tests.Integration --version 4.0.911
                    
NuGet\Install-Package Soenneker.Tests.Integration -Version 4.0.911
                    
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.Tests.Integration" Version="4.0.911" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Tests.Integration" Version="4.0.911" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Tests.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.Tests.Integration --version 4.0.911
                    
#r "nuget: Soenneker.Tests.Integration, 4.0.911"
                    
#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.Tests.Integration@4.0.911
                    
#: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.Tests.Integration&version=4.0.911
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Tests.Integration&version=4.0.911
                    
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.Tests.Integration

A TUnit base class for HTTP and service-level tests over a shared WebApplicationFactory supplied by IntegrationTestHost.

Installation

dotnet add package Soenneker.Tests.Integration

Define the host

using Soenneker.TestHosts.Integration;

public sealed class Host : IntegrationTestHost
{
    public override Task InitializeAsync()
    {
        RegisterFactory<Api.Program>("Api");
        return base.InitializeAsync();
    }
}

The project name identifies the appsettings location expected by IntegrationTestHost. See that package's README for the output-directory convention.

Define the tests

using Soenneker.Tests.Integration;

[ClassDataSource<Host>(Shared = SharedType.PerTestSession)]
public sealed class OrdersApiTests : IntegrationTest<Api.Program>
{
    public OrdersApiTests(Host host) : base(host)
    {
    }

    [Test]
    public async Task Gets_orders()
    {
        using HttpResponseMessage response = await Client.GetAsync("/orders");

        await Assert.That(response.IsSuccessStatusCode).IsTrue();
    }
}

Client is created lazily and disposed with the test instance. It uses the test authentication scheme with ClientUserId and ClientEmail; it does not add an admin role. Use Factory.CreateTestHttpClient(...) directly when a test needs another identity, roles, or a JWT.

Resolving services

OrderRepository repository = Resolve<OrderRepository>(scoped: true);

Resolve<T>() uses the application's root provider. Resolve<T>(scoped: true) creates one async scope per test instance, reuses it, and disposes it during teardown. Factory is owned by the shared host and must not be disposed by individual tests.

Background work and static resolution

WaitOnQueueToEmpty(cancellationToken) polls the application's IQueueInformationUtil every 500 milliseconds until processing stops. Supply a bounded cancellation token; the default token allows an unhealthy queue to wait indefinitely.

StaticResolve<T>() targets the most recently constructed IntegrationTest<TEntryPoint> instance. Avoid it in parallel tests because another instance of the same generic test base can replace the static target; prefer the instance Resolve<T>() method.

The base class reuses the host's Faker and AutoFaker, and resolves logging through the test's application scope.

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.911 0 8/31/2026
4.0.910 0 8/31/2026
4.0.908 8 8/30/2026
4.0.907 11 8/30/2026
4.0.906 17 8/30/2026
4.0.905 33 8/30/2026
4.0.903 36 8/30/2026
4.0.901 47 8/30/2026
4.0.900 36 8/30/2026
4.0.899 43 8/30/2026
4.0.897 70 8/30/2026
4.0.896 36 8/29/2026
4.0.894 46 8/29/2026
4.0.893 40 8/29/2026
4.0.892 36 8/29/2026
4.0.890 44 8/27/2026
4.0.889 46 8/27/2026
4.0.888 60 8/26/2026
4.0.887 61 8/26/2026
4.0.886 69 8/26/2026
Loading failed

Update dependency Soenneker.Tests.Logging to 4.0.155 (#1435)