Skip to content

Commit

Permalink
#28: Synergy.Contracts: Added Fail.IfTooLongOrWhitespace(text, max le…
Browse files Browse the repository at this point in the history
…ngth) method
  • Loading branch information
MarcinCelej committed Feb 3, 2024
1 parent fd1dde8 commit e2a5905
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
- Fail.IfTooLongOrWhitespace(
value: string [CanBeNull],
maxLength: int,
name: string [NotNull, NotNull]
name: string? [Nullable, CallerArgumentExpression, Optional]
) : void [AssertionMethod]
- Fail.IfTrue(
value: bool [AssertionCondition],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
- Fail.IfTooLongOrWhitespace(
value: string [CanBeNull],
maxLength: int,
name: string [NotNull, NotNull]
name: string? [Nullable, CallerArgumentExpression, Optional]
) : void [AssertionMethod]
- Fail.IfTrue(
value: bool [AssertionCondition],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
- Fail.IfTooLongOrWhitespace(
value: string [CanBeNull],
maxLength: int,
name: string [NotNull, NotNull]
name: string? [Nullable, CallerArgumentExpression, Optional]
) : void [AssertionMethod]
- Fail.IfTrue(
value: bool [AssertionCondition],
Expand Down
Binary file modified Contracts/Synergy.Contracts.Test/Failures/FailStringTest.cs
Binary file not shown.
7 changes: 6 additions & 1 deletion Contracts/Synergy.Contracts/Failures/FailString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ string name
public static void IfTooLongOrWhitespace(
[CanBeNull] string value,
int maxLength,
[NotNull] [System.Diagnostics.CodeAnalysis.NotNull] string name)
#if NET6_0_OR_GREATER
[System.Runtime.CompilerServices.CallerArgumentExpression("value")] string? name = null
#else
string name
#endif
)
{
Fail.IfArgumentWhiteSpace(value, name);
Fail.IfTooLong(value, maxLength, name);
Expand Down

0 comments on commit e2a5905

Please sign in to comment.