Conversation
Code ReviewThe implementation follows the established patterns in Two issues found: 1. Missing Public API snapshot updates (CLAUDE.md violation)Severity: Required
The analogous existing type
Fix: Run the # From the TUnit.PublicAPI directory
dotnet test
# Then accept the output:
for f in *.received.txt; do mv "$f" "${f%.received.txt}.verified.txt"; done
git add *.verified.txt2.
|
b950983 to
28ce284
Compare
28ce284 to
e23c286
Compare
e23c286 to
cf5f7b1
Compare
cf5f7b1 to
c10dc39
Compare
… HasLengthBetween) Add three new string assertion methods for validating string length ranges: - HasMinLength(int) - asserts string length >= minLength - HasMaxLength(int) - asserts string length <= maxLength - HasLengthBetween(int, int) - asserts min <= string length <= max Closes #4868
Add verified snapshots for HasMinLength, HasMaxLength, and HasLengthBetween assertion methods added to the string assertions API.
1401303 to
cf3d677
Compare
Summary
HasMinLength(int minLength)assertion that verifies a string's length is >= the specified minimumHasMaxLength(int maxLength)assertion that verifies a string's length is <= the specified maximumHasLengthBetween(int min, int max)assertion that verifies a string's length is within an inclusive rangeAll three follow the existing assertion patterns (condition classes in
StringAssertions.cs, extension methods inAssertionExtensions.cs) and supportCallerArgumentExpressionfor readable error messages.Closes #4868
Test plan
HasMinLengthpasses for strings at or above the minimum lengthHasMinLengthfails for strings below the minimum lengthHasMaxLengthpasses for strings at or below the maximum lengthHasMaxLengthfails for strings above the maximum lengthHasLengthBetweenpasses for strings within the inclusive rangeHasLengthBetweenfails for strings outside the rangeAssert.That(str).HasMinLength(3).And.HasMaxLength(10))