Skip to content

Commit

Permalink
#28: Synergy.Contracts: Added Fail.IfTooLong(text, max length) method
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinCelej committed Feb 3, 2024
1 parent 9e7380e commit bb50fc4
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 @@ -206,7 +206,7 @@
- Fail.IfTooLong(
value: string [CanBeNull],
maxLength: int,
name: string [NotNull, NotNull]
name: string? [Nullable, CallerArgumentExpression, Optional]
) : void [AssertionMethod]
- Fail.IfTooLongOrWhitespace(
value: string [CanBeNull],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
- Fail.IfTooLong(
value: string [CanBeNull],
maxLength: int,
name: string [NotNull, NotNull]
name: string? [Nullable, CallerArgumentExpression, Optional]
) : void [AssertionMethod]
- Fail.IfTooLongOrWhitespace(
value: string [CanBeNull],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
- Fail.IfTooLong(
value: string [CanBeNull],
maxLength: int,
name: string [NotNull, NotNull]
name: string? [Nullable, CallerArgumentExpression, Optional]
) : void [AssertionMethod]
- Fail.IfTooLongOrWhitespace(
value: string [CanBeNull],
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 @@ -181,7 +181,12 @@ public static void IfWhitespace(
public static void IfTooLong(
[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.RequiresArgumentName(name);

Expand Down

0 comments on commit bb50fc4

Please sign in to comment.