ResQ.BuildingBlocks.Testing.Integration 0.2.0

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

ResQ.BuildingBlocks.Testing.Integration

Docker-backed integration-test helpers for the ResQ building blocks. Kept separate from ResQ.BuildingBlocks.Testing so that unit-only consumers never drag in Docker or the ASP.NET Core test host.

Targets net9.0 only (matches Microsoft.AspNetCore.Mvc.Testing 9.0.0, whose assets are net9-only). Carries a FrameworkReference on Microsoft.AspNetCore.App and depends on ResQ.BuildingBlocks.Testing + Application + Domain.

What's in the box

Type Role
PostgresContainerFixture Starts a throwaway PostgreSQL container (Testcontainers) for a collection
DatabaseCollection xUnit [CollectionDefinition("database")] sharing one container
ResqWebApplicationFactory<TEntryPoint> WebApplicationFactory with a ConfigureTestServices hook

Requirements

A running Docker daemon. PostgresContainerFixture.InitializeAsync() throws when Docker is unavailable, so gate these tests in CI — for example tag them [Trait("Category","Integration")] and run dotnet test --filter Category=Integration only on a Docker-enabled job.

Quick start

using ResQ.BuildingBlocks.Testing.Integration;
using Xunit;

[Collection("database")]
public sealed class WidgetApiTests
{
    private readonly PostgresContainerFixture _db;

    public WidgetApiTests(PostgresContainerFixture db) => _db = db;

    [Fact]
    [Trait("Category", "Integration")]
    public async Task Creates_a_widget()
    {
        await using var factory = new ApiFactory(_db.ConnectionString);
        using var client = factory.CreateClient();

        var response = await client.PostAsJsonAsync("/api/v1/widgets", new { name = "gadget" });

        response.EnsureSuccessStatusCode();
    }
}

// Point the app under test at the container database.
internal sealed class ApiFactory(string connectionString) : ResqWebApplicationFactory<Program>
{
    protected override void ConfigureTestServices(IServiceCollection services)
    {
        // e.g. replace the production DbContext options with `connectionString`
    }
}

License

Apache-2.0. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
0.2.0 182 8/16/2026