Path: redb-route/tests/redb.Route.Tests.Kafka/KafkaConnectionFactoryLoudTests.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Kafka/KafkaConnectionFactoryLoudTests.cs
----
using redb.Route.Core;
using redb.Route.Kafka;
namespace redb.Route.Tests.Kafka;
///
/// A set-but-unknown connectionFactory name must fail loud —
/// never silently fall back to URI parameters.
///
public sealed class KafkaConnectionFactoryLoudTests
{
[Fact]
public async Task ConnectionFactoryTypo_FailsLoud()
{
await using var ctx = new RouteContext();
ctx.AddComponent(new KafkaComponent());
var act = () => ctx.GetEndpoint("kafka://orders?connectionFactory=typo-name&brokers=localhost:9092");
act.Should().Throw()
.Which.Message.Should().Contain("typo-name");
}
[Fact]
public async Task ConnectionFactoryRegistered_Resolves()
{
await using var ctx = new RouteContext();
ctx.AddComponent(new KafkaComponent());
ctx.AddToRegistry("real", new KafkaConnectionFactory { Brokers = "broker:9092" });
var endpoint = ctx.GetEndpoint("kafka://orders?connectionFactory=real");
endpoint.Should().NotBeNull();
}
}