Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extensions for
OccurrenceConstraint
that reads more fluently (#…
- Loading branch information
Showing
10 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
Src/FluentAssertions/Extensions/OccurrenceConstraintExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
|
||
namespace FluentAssertions.Extensions; | ||
|
||
/// <summary> | ||
/// Provides extensions to write <see cref="OccurrenceConstraint" />s with fluent syntax | ||
/// </summary> | ||
public static class OccurrenceConstraintExtensions | ||
{ | ||
/// <summary> | ||
/// This is the equivalent to <see cref="Exactly.Times(int)" /> | ||
/// </summary> | ||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="times"/> is less than zero.</exception> | ||
public static OccurrenceConstraint TimesExactly(this int times) | ||
{ | ||
return Exactly.Times(times); | ||
} | ||
|
||
/// <summary> | ||
/// This is the equivalent to <see cref="AtMost.Times(int)" /> | ||
/// </summary> | ||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="times"/> is less than zero.</exception> | ||
public static OccurrenceConstraint TimesOrLess(this int times) | ||
{ | ||
return AtMost.Times(times); | ||
} | ||
|
||
/// <summary> | ||
/// This is the equivalent to <see cref="AtLeast.Times(int)" /> | ||
/// </summary> | ||
/// <exception cref="ArgumentOutOfRangeException"><paramref name="times"/> is less than zero.</exception> | ||
public static OccurrenceConstraint TimesOrMore(this int times) | ||
{ | ||
return AtLeast.Times(times); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters