Koto.Testing.Integration
0.4.0
dotnet add package Koto.Testing.Integration --version 0.4.0
NuGet\Install-Package Koto.Testing.Integration -Version 0.4.0
<PackageReference Include="Koto.Testing.Integration" Version="0.4.0" />
<PackageVersion Include="Koto.Testing.Integration" Version="0.4.0" />
<PackageReference Include="Koto.Testing.Integration" />
paket add Koto.Testing.Integration --version 0.4.0
#r "nuget: Koto.Testing.Integration, 0.4.0"
#:package Koto.Testing.Integration@0.4.0
#addin nuget:?package=Koto.Testing.Integration&version=0.4.0
#tool nuget:?package=Koto.Testing.Integration&version=0.4.0
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 | 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
- Confluent.Kafka (>= 2.14.0)
- Koto.Application (>= 0.4.0)
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 | 90 | 7/21/2026 |
| 0.3.0-preview.15 | 43 | 7/21/2026 |