Soenneker.Tests.Integration
4.0.910
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Tests.Integration --version 4.0.910
NuGet\Install-Package Soenneker.Tests.Integration -Version 4.0.910
<PackageReference Include="Soenneker.Tests.Integration" Version="4.0.910" />
<PackageVersion Include="Soenneker.Tests.Integration" Version="4.0.910" />
<PackageReference Include="Soenneker.Tests.Integration" />
paket add Soenneker.Tests.Integration --version 4.0.910
#r "nuget: Soenneker.Tests.Integration, 4.0.910"
#:package Soenneker.Tests.Integration@4.0.910
#addin nuget:?package=Soenneker.Tests.Integration&version=4.0.910
#tool nuget:?package=Soenneker.Tests.Integration&version=4.0.910
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 | 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
- Soenneker.Extensions.ServiceProvider (>= 4.0.333)
- Soenneker.Extensions.WebApplicationFactories (>= 4.0.331)
- Soenneker.TestHosts.Integration (>= 4.0.155)
- Soenneker.Tests.Logging (>= 4.0.154)
- Soenneker.Utils.BackgroundQueue (>= 4.0.2474)
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.912 | 0 | 8/31/2026 |
| 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 |
Update dependency Soenneker.Extensions.WebApplicationFactories to 4.0.329 (#1431)