Path: redb-route/tests/redb.Route.Tests.Sql/Batch/BatchEmptySourceTests.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.Sql/Batch/BatchEmptySourceTests.cs
----
using redb.Route.Core;
using redb.Route.Tests.Sql.Batch.Fakes;
using redb.Route.Tests.Sql.E2E.Infrastructure;
namespace redb.Route.Tests.Sql.Batch;
/// An empty batch source writes nothing and reports zero, as Camel's empty executeBatch() does.
public sealed class BatchEmptySourceTests
{
[Fact]
public async Task Batch_EmptyList_ExecutesNothing()
{
var connection = new FakeBatchConnection();
var factory = new FixedConnectionFactory(connection);
await using var context = new RouteContext();
var endpoint = SqlEndpointHarness.CreateEndpoint(context, factory, "INSERT INTO t (id, val) VALUES (:#id, :#val)", new()
{
["outputType"] = "None",
["batchSize"] = "10",
});
var exchange = new Exchange(new Message(new List>()));
await endpoint.CreateProducer().Process(exchange, CancellationToken.None);
factory.Requests.Should().Be(0, "an empty batch needs no connection");
connection.Executions.Should().Be(0, "an empty batch must not run the statement once with NULL parameters");
Convert.ToInt32(exchange.In.Headers["redbSql.updateCount"]).Should().Be(0);
}
}