Koto.Testing.Integration 0.3.0-preview.15

This is a prerelease version of Koto.Testing.Integration.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Koto.Testing.Integration --version 0.3.0-preview.15
                    
NuGet\Install-Package Koto.Testing.Integration -Version 0.3.0-preview.15
                    
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="Koto.Testing.Integration" Version="0.3.0-preview.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Koto.Testing.Integration" Version="0.3.0-preview.15" />
                    
Directory.Packages.props
<PackageReference Include="Koto.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 Koto.Testing.Integration --version 0.3.0-preview.15
                    
#r "nuget: Koto.Testing.Integration, 0.3.0-preview.15"
                    
#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 Koto.Testing.Integration@0.3.0-preview.15
                    
#: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=Koto.Testing.Integration&version=0.3.0-preview.15&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Koto.Testing.Integration&version=0.3.0-preview.15&prerelease
                    
Install as a Cake Tool

Koto.Testing.Integration

Building blocks for integration tests of Koto microservices (WebApplicationFactory + Testcontainers style). Extracted from real service suites by the rule of three: test auth, async-effect assertions, and a convention-driven Kafka test producer kept getting copy-pasted between test projects.

Header test authentication

Replaces the host's real authentication (JWKS, JWT) with a scheme driven by request headers X-Test-UserId / X-Test-Role:

Factory = new WebApplicationFactory<Program>().WithWebHostBuilder(builder =>
{
    builder.ConfigureServices(services => services.AddHeaderTestAuthentication());
});

using var client = Factory.CreateClient().WithTestUser(userId);          // participant
using var admin  = Factory.CreateClient().WithTestUser(adminId, "Admin"); // role check

Eventually

Polling assertion for asynchronous effects (Kafka consumers, projections, sagas). The description lands in the timeout message:

await Eventually.AssertAsync(async () =>
{
    var detail = await client.GetFromJsonAsync<JsonElement>($"/meetups/{id}");
    return detail.GetProperty("status").GetString() == "Settled";
}, TimeSpan.FromSeconds(45), "meetup becomes Settled");

RawJsonKafkaProducer

Publishes plain web-cased JSON — exactly what PublishIntegrationEvents (Koto.Messaging.Wolverine) produces — so a test can simulate an upstream service or a redelivery. The topic comes from the contract's public const string Topic (shared convention via IntegrationEventTopics in Koto.Application):

using var kafka = new RawJsonKafkaProducer(kafkaContainer.GetBootstrapAddress());
await kafka.PublishAsync(new UserRegisteredV1(userId, null, "Ivan", ["ru"]));   // topic resolved from the type
await kafka.PublishAsync("explicit.topic", payload);                            // or explicit

No Testcontainers dependency: container lifecycle stays in your fixture — these pieces compose with any host/container layout (single service, multi-service saga, in-memory TestServer).

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
0.4.0 91 7/21/2026
0.3.0-preview.15 43 7/21/2026