feat(core): naming templates with tokens, formats and sanitizing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 09:37:52 +00:00
1 parent c40b6a7cd3
commit a76695f2e9
4 files changed
+346

No files matched your search

+11
View File
@@ -142,6 +142,17 @@ public static class Assert
if (!collection.Contains(expected)) Fail($"{expression}: does not contain {Format(expected)}");
}
/// <summary>At least one element satisfies <paramref name="predicate"/>.</summary>
public static T Contains<T>(IEnumerable<T> collection, Func<T, bool> predicate, [CallerArgumentExpression(nameof(predicate))] string? expression = null)
{
foreach (var item in collection)
{
if (predicate(item)) return item;
}
Fail($"No element matches {expression}");
return default!;
}
public static void DoesNotContain<T>(T unexpected, IEnumerable<T> collection, [CallerArgumentExpression(nameof(collection))] string? expression = null)
{
if (collection.Contains(unexpected)) Fail($"{expression}: unexpectedly contains {Format(unexpected)}");