Koto.Testing.Integration
0.5.0-preview.4
See the version list below for details.
dotnet add package Koto.Testing.Integration --version 0.5.0-preview.4
NuGet\Install-Package Koto.Testing.Integration -Version 0.5.0-preview.4
<PackageReference Include="Koto.Testing.Integration" Version="0.5.0-preview.4" />
<PackageVersion Include="Koto.Testing.Integration" Version="0.5.0-preview.4" />
<PackageReference Include="Koto.Testing.Integration" />
paket add Koto.Testing.Integration --version 0.5.0-preview.4
#r "nuget: Koto.Testing.Integration, 0.5.0-preview.4"
#:package Koto.Testing.Integration@0.5.0-preview.4
#addin nuget:?package=Koto.Testing.Integration&version=0.5.0-preview.4&prerelease
#tool nuget:?package=Koto.Testing.Integration&version=0.5.0-preview.4&prerelease
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.5.0-preview.4)
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.5.0-preview.9 | 46 | 11/30/2026 |
| 0.5.0-preview.8 | 53 | 11/30/2026 |
| 0.5.0-preview.7 | 50 | 11/29/2026 |
| 0.5.0-preview.6 | 57 | 11/29/2026 |
| 0.5.0-preview.5 | 57 | 11/29/2026 |
| 0.5.0-preview.4 | 54 | 11/29/2026 |
| 0.5.0-preview.3 | 54 | 11/29/2026 |
| 0.5.0-preview.2 | 54 | 11/29/2026 |
| 0.5.0-preview.1 | 64 | 11/8/2026 |
| 0.4.0 | 167 | 7/21/2026 |
| 0.3.0-preview.15 | 87 | 7/21/2026 |
0.5.0-preview.4 — a value object's factory parses and never answers "required": MustBeValueObject reports a missing value itself (general.value.is-required, bound to the field) and does not call the factory with null. Remove "required" errors from value-object factories. Since preview.3: analyzers KOTO001 (a result is discarded) and KOTO002 (FirstError returned as the failure) are errors. Migration guide: https://github.com/arigatory/Koto/blob/main/docs/migrations/0.4-to-0.5.md