Path: redb-route/tests/redb.Route.Tests/Expressions/FormatFunctionTests.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/FormatFunctionTests.cs
----
using System.Globalization;
using redb.Route.Abstractions;
using redb.Route.Core;
using redb.Route.Expressions;
using redb.Route.TestKit;
namespace redb.Route.Tests.Expressions;
///
/// format(value, pattern[, culture]) — the explicit locale escape hatch the V4 breaking change
/// points at: since ${...} renders culture-invariant, this is how a route asks for local text on
/// purpose. It was documented (CHANGELOG, expressions guide) before it existed; these tests are the
/// contract.
///
[Collection("ExpressionResolver")]
public class FormatFunctionTests
{
private static IExchange Exchange(params (string Name, object? Value)[] headers)
{
var exchange = redb.Route.Core.Exchange.Create(new Message("body"), null);
foreach (var (name, value) in headers) exchange.In.Headers[name] = value;
return exchange;
}
private static object? Eval(string expression, IExchange exchange)
=> new StringExpression(expression).Evaluate