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:
4 files changed
+346
No files matched your search
@@ -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)}");
|
||||
|
||||
Reference in new issue
Block a user