Path: redb-route/tests/redb.Route.Tests/Expressions/IncrementOperandTests.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/Expressions/IncrementOperandTests.cs
----
using AwesomeAssertions;
using redb.Route.Core;
using redb.Route.Expressions;
namespace redb.Route.Tests.Expressions;
///
/// The operand of ++ / -- (findings register row 23): a missing value starts at 0, a number or a numeric
/// text counts, and a value that is there but not a number is an error naming it instead of silently becoming 0.
///
public sealed class IncrementOperandTests
{
private static Exchange Message(object? value)
{
var exchange = new Exchange(new Message("x"));
if (value is not null)
exchange.In.Headers["x"] = value;
return exchange;
}
[Theory]
[InlineData(null, 0, 1)]
[InlineData(5, 5, 6)]
[InlineData("7", 7, 8)]
public void ACounter_Counts(object? start, int returns, int after)
{
var exchange = Message(start);
Convert.ToInt32(new StringExpression("header.x++").Evaluate