Skip to content

Commit 3910c2e

Browse files
Sergio0694michael-hawkerazchohfi
authored
Guard APIs for .NET Standard 2.1 (#3167)
* Initial guard APIs added * Added EqualTo and NotEqualTo APIs * Added more Guard APIs * New interval Guard APIs added * Added Guard APIs for IEnumerable<T> values * Renamed APIs * Added Guard APIs for Stream values * Added Guard APIs for ReadOnlySpan<T> values * Added Guard APIs for ReadOnlyMemory<T> values * Code refactoring * Minor code refactoring * Added Guard.IsBitwiseEqualTo<T> API * Added Guard.IsNull API * Code refactoring and optimizations * Code refactoring * Added Guard.HasSizeNotEqualTo<T> API * Added Guard size API overloads for the string type * Added Guard size API overloads for T[] arrays * Code refactoring * Removed unnecessary using directives * Added Guard reference check APIs * Added new Guaard APIs for string values * Improved Guard.IsBitwiseEqualTo<T> API * Improved Guard.IsNull APIs * Added new size APIs for copy operations * Added new type test APIs, minor code tweaks * Minor bug fixes * Added Guard APIs for Task values * Minor code tweak * Added new Guard.IsEmpty APIs * Refactored code to remove unsafe requirement * Added Guard.IsInRange<T> APIs * Added missing type checks in Guard.IsBitwiseEqualTo API * Added ValueTypeExtensions.ToHexString API * Code refactoring * Added ValueTypeExtensions tests * Added general Guard tests * Bug fixes in the Guard class * Minor speed improvements * Code refactoring * Removed unnecessary using directives * More speed improvements and API refactoring * Refactored/fixed some Guard APIs * More bug fixes * Added Guard tests for array APIs * Fixed the Guard.IsNotEmpty<T> array API * Moved exception throwers to separate class * Moved general Guard throwers to separate class * Disabled warning for XML overload resolution * Moved array Guard throwers to separate class * Moved stream Guard throwers to separate class * Fixed some XML docs * Moved enumerable Guard throwers to separate class * Moved task Guard throwers to separate class * Added new Guard APIs for tasks * Moved string Guard throwers to separate class * Moved ReadOnlySpan<T> Guard throwers to separate class * Added Span<T> APIs to the Guard class * Moved ReadOnlyMemory<T> Guard throwers to separate class * Added Memory<T> APIs to the Guard class * Minor code refactoring * Update file headers * Removed unnecessary methods * Added TypeExtensions.ToTypeString extension * Improved error messages for general Guard APIs * Improved error messages for Enumerable Guard APIs * Improved error messages for stream Guard APIs * Improved error messages for array Guard APIs * Improved error messages for string Guard APIs * Improved error messages for task Guard APIs * Improved error messages for span Guard APIs * Improved error messages for memory Guard APIs * Improved type string for nullable types * Improved type string for value tuple types * Minor performance improvement * Added numeric comparison T4 file * Updated .gitignore to skip generated files * Moved comparison Guard APIs to separate file * Renamed template file, fixed incorrect XML doc * Fixed missing blank line * Removed unnecessary type parameters * Moved enumerable Guard APIs to separate file * Code refactoring in the enumerable T4 template * Renamed a file * Added empty template for ThrowHelper.Collection * Code refactoring in the T4 templates * Switched collection throw helpers to T4 generation * Code refactoring * Removed incorrect file header * Added new Guard.IsInRangeFor API * Updated .gitignore, added generated files to source control * Added tests for Guard.IsInRangeFor * Improved formatting of values in error messages * Improved error messages * More improvements to the error messages * Minor code tweaks * Added Guard.IsNotOfType APIs * Added Guard.IsNotAssignableToType APIs * Added Guard.IsDefault<T> APIs * Fixed some XML docs * Added missing [Pure] attribute * Fixed typo in a comment * Removed unnecessary comment after code changes * Added XML comment for the T4 service * Added more comments to ToHexString * Suppressed an incorrect code style warning * Added more tests for Guard.IsInRange * Added Guard.IsNotInRangeFor APIs * Added readme file for the T4 templates * Changed generated files extension to .g.cs to avoid conflicts * Added Guard.IsCloseTo and Guard.IsNotCloseTo APIs * Added tests for IsCloseTo * Updated ".g.cs" extension for generated files Co-Authored-By: Michael Hawker MSFT (XAML Llama) <[email protected]> * Removed extra space (typo) Co-Authored-By: Michael Hawker MSFT (XAML Llama) <[email protected]> * More tweakes to the Guard.md file * Excluded TypeInfo.g.cs file from .ttinclude from checkout * Added more info about target ranges for some APIs * Added IsCloseTo overloads for long type * Minor code tweaks * Added comment to describe (uint) cast range check trick * Added a nore about the .g.cs files being checked in * Added .NET Standard 2.1 target, adjusted imported packages * Added [NotNull] attributes when needed * Added flow attributes to bool Guard APIs * Added missing Guard APIs for the string type * Added shared main unit test project * Removed duplicate files from UWP unit test project * Refactored UWP unit tests project (can't be in same folder as .shproj) * Moved markdown tests back into UWP project * Added UnitTests.NetCore project * Fixed some styling issues in test projects * Added .editorconfig file to UniTests.NetCore project too * Moved .editorconfig file to Shared project folder * Removed NetCore Tests compilation for Native Configuration. * Update Windows Community Toolkit.sln * Updated multiline comments style * Renamed some Guard APIs * Fixed collections tests, moved to shared project * Removed unnecessary [SuppressMessage] attributes * Added internal [NotNull] and [DoesNotReturnIf] attributes * Removed build warnings * Removed leftover compiler directives * Added Guard.IsTrue/False overloads with custom message * Fixed test file location after merge * Fixed Span<T> and Unsafe package references Co-authored-by: Michael Hawker MSFT (XAML Llama) <[email protected]> Co-authored-by: Alexandre Zollinger Chohfi <[email protected]> Co-authored-by: Alexandre Zollinger Chohfi <[email protected]> Co-authored-by: Michael Hawker MSFT (XAML Llama) <[email protected]>
1 parent 01075ff commit 3910c2e

File tree

105 files changed

+566
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+566
-225
lines changed

Microsoft.Toolkit.Parsers/Markdown/Blocks/ListBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using Microsoft.Toolkit.Parsers.Core;
1212
using Microsoft.Toolkit.Parsers.Markdown.Helpers;
1313

14-
[assembly: InternalsVisibleTo("UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010041753af735ae6140c9508567666c51c6ab929806adb0d210694b30ab142a060237bc741f9682e7d8d4310364b4bba4ee89cc9d3d5ce7e5583587e8ea44dca09977996582875e71fb54fa7b170798d853d5d8010b07219633bdb761d01ac924da44576d6180cdceae537973982bb461c541541d58417a3794e34f45e6f2d129e2")]
14+
[assembly: InternalsVisibleTo("UnitTests.UWP, PublicKey=002400000480000094000000060200000024000052534131000400000100010041753af735ae6140c9508567666c51c6ab929806adb0d210694b30ab142a060237bc741f9682e7d8d4310364b4bba4ee89cc9d3d5ce7e5583587e8ea44dca09977996582875e71fb54fa7b170798d853d5d8010b07219633bdb761d01ac924da44576d6180cdceae537973982bb461c541541d58417a3794e34f45e6f2d129e2")]
1515

1616
namespace Microsoft.Toolkit.Parsers.Markdown.Blocks
1717
{

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
// General Information about an assembly is controlled through the following
99
// set of attributes. Change these attribute values to modify the information
1010
// associated with an assembly.
11-
[assembly: InternalsVisibleTo("UnitTests")]
11+
[assembly: InternalsVisibleTo("UnitTests.UWP")]
1212
[assembly: NeutralResourcesLanguage("en-US")]

Microsoft.Toolkit.Uwp.UI.Controls/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
// General Information about an assembly is controlled through the following
99
// set of attributes. Change these attribute values to modify the information
1010
// associated with an assembly.
11-
[assembly: InternalsVisibleTo("UnitTests")]
11+
[assembly: InternalsVisibleTo("UnitTests.UWP")]
1212
[assembly: NeutralResourcesLanguage("en-US")]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
#if !NETSTANDARD2_1
6+
7+
namespace System.Diagnostics.CodeAnalysis
8+
{
9+
/// <summary>
10+
/// Specifies that a given <see cref="ParameterValue"/> also indicates
11+
/// whether the method will not return (eg. throw an exception).
12+
/// </summary>
13+
/// <remarks>Internal copy of the .NET Standard 2.1 attribute.</remarks>
14+
[AttributeUsage(AttributeTargets.Parameter)]
15+
internal sealed class DoesNotReturnIfAttribute : Attribute
16+
{
17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="DoesNotReturnIfAttribute"/> class.
19+
/// </summary>
20+
/// <param name="parameterValue">
21+
/// The condition parameter value. Code after the method will be considered unreachable
22+
/// by diagnostics if the argument to the associated parameter matches this value.
23+
/// </param>
24+
public DoesNotReturnIfAttribute(bool parameterValue)
25+
{
26+
ParameterValue = parameterValue;
27+
}
28+
29+
/// <summary>
30+
/// Gets a value indicating whether the parameter value should be <see langword="true"/>.
31+
/// </summary>
32+
public bool ParameterValue { get; }
33+
}
34+
}
35+
36+
#endif
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
#if !NETSTANDARD2_1
6+
7+
namespace System.Diagnostics.CodeAnalysis
8+
{
9+
/// <summary>
10+
/// Specifies that an output will not be <see langword="null"/> even if the corresponding type allows it.
11+
/// Specifies that an input argument was not <see langword="null"/> when the call returns.
12+
/// </summary>
13+
/// <remarks>Internal copy of the .NET Standard 2.1 attribute.</remarks>
14+
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue)]
15+
internal sealed class NotNullAttribute : Attribute
16+
{
17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="NotNullAttribute"/> class.
19+
/// </summary>
20+
public NotNullAttribute()
21+
{
22+
}
23+
}
24+
}
25+
26+
#endif

Microsoft.Toolkit/Diagnostics/Generated/Guard.Collection.g.cs

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4-
5-
/* ========================
6-
* Auto generated file
7-
* ===================== */
4+
// =====================
5+
// Auto generated file
6+
// =====================
87

98
using System;
109
using System.Collections.Generic;
@@ -94,11 +93,11 @@ public static void HasSizeNotEqualTo<T>(Span<T> span, int size, string name)
9493
/// <param name="name">The name of the input parameter being tested.</param>
9594
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="span"/> is &lt;= <paramref name="size"/>.</exception>
9695
[MethodImpl(MethodImplOptions.AggressiveInlining)]
97-
public static void HasSizeOver<T>(Span<T> span, int size, string name)
96+
public static void HasSizeGreaterThan<T>(Span<T> span, int size, string name)
9897
{
9998
if (span.Length <= size)
10099
{
101-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(span, size, name);
100+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(span, size, name);
102101
}
103102
}
104103

@@ -111,11 +110,11 @@ public static void HasSizeOver<T>(Span<T> span, int size, string name)
111110
/// <param name="name">The name of the input parameter being tested.</param>
112111
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="span"/> is &lt; <paramref name="size"/>.</exception>
113112
[MethodImpl(MethodImplOptions.AggressiveInlining)]
114-
public static void HasSizeAtLeast<T>(Span<T> span, int size, string name)
113+
public static void HasSizeGreaterThanOrEqualTo<T>(Span<T> span, int size, string name)
115114
{
116115
if (span.Length < size)
117116
{
118-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(span, size, name);
117+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(span, size, name);
119118
}
120119
}
121120

@@ -296,11 +295,11 @@ public static void HasSizeNotEqualTo<T>(ReadOnlySpan<T> span, int size, string n
296295
/// <param name="name">The name of the input parameter being tested.</param>
297296
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="span"/> is &lt;= <paramref name="size"/>.</exception>
298297
[MethodImpl(MethodImplOptions.AggressiveInlining)]
299-
public static void HasSizeOver<T>(ReadOnlySpan<T> span, int size, string name)
298+
public static void HasSizeGreaterThan<T>(ReadOnlySpan<T> span, int size, string name)
300299
{
301300
if (span.Length <= size)
302301
{
303-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(span, size, name);
302+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(span, size, name);
304303
}
305304
}
306305

@@ -313,11 +312,11 @@ public static void HasSizeOver<T>(ReadOnlySpan<T> span, int size, string name)
313312
/// <param name="name">The name of the input parameter being tested.</param>
314313
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="span"/> is &lt; <paramref name="size"/>.</exception>
315314
[MethodImpl(MethodImplOptions.AggressiveInlining)]
316-
public static void HasSizeAtLeast<T>(ReadOnlySpan<T> span, int size, string name)
315+
public static void HasSizeGreaterThanOrEqualTo<T>(ReadOnlySpan<T> span, int size, string name)
317316
{
318317
if (span.Length < size)
319318
{
320-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(span, size, name);
319+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(span, size, name);
321320
}
322321
}
323322

@@ -498,11 +497,11 @@ public static void HasSizeNotEqualTo<T>(Memory<T> memory, int size, string name)
498497
/// <param name="name">The name of the input parameter being tested.</param>
499498
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="memory"/> is &lt;= <paramref name="size"/>.</exception>
500499
[MethodImpl(MethodImplOptions.AggressiveInlining)]
501-
public static void HasSizeOver<T>(Memory<T> memory, int size, string name)
500+
public static void HasSizeGreaterThan<T>(Memory<T> memory, int size, string name)
502501
{
503502
if (memory.Length <= size)
504503
{
505-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(memory, size, name);
504+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(memory, size, name);
506505
}
507506
}
508507

@@ -515,11 +514,11 @@ public static void HasSizeOver<T>(Memory<T> memory, int size, string name)
515514
/// <param name="name">The name of the input parameter being tested.</param>
516515
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="memory"/> is &lt; <paramref name="size"/>.</exception>
517516
[MethodImpl(MethodImplOptions.AggressiveInlining)]
518-
public static void HasSizeAtLeast<T>(Memory<T> memory, int size, string name)
517+
public static void HasSizeGreaterThanOrEqualTo<T>(Memory<T> memory, int size, string name)
519518
{
520519
if (memory.Length < size)
521520
{
522-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(memory, size, name);
521+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(memory, size, name);
523522
}
524523
}
525524

@@ -700,11 +699,11 @@ public static void HasSizeNotEqualTo<T>(ReadOnlyMemory<T> memory, int size, stri
700699
/// <param name="name">The name of the input parameter being tested.</param>
701700
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="memory"/> is &lt;= <paramref name="size"/>.</exception>
702701
[MethodImpl(MethodImplOptions.AggressiveInlining)]
703-
public static void HasSizeOver<T>(ReadOnlyMemory<T> memory, int size, string name)
702+
public static void HasSizeGreaterThan<T>(ReadOnlyMemory<T> memory, int size, string name)
704703
{
705704
if (memory.Length <= size)
706705
{
707-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(memory, size, name);
706+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(memory, size, name);
708707
}
709708
}
710709

@@ -717,11 +716,11 @@ public static void HasSizeOver<T>(ReadOnlyMemory<T> memory, int size, string nam
717716
/// <param name="name">The name of the input parameter being tested.</param>
718717
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="memory"/> is &lt; <paramref name="size"/>.</exception>
719718
[MethodImpl(MethodImplOptions.AggressiveInlining)]
720-
public static void HasSizeAtLeast<T>(ReadOnlyMemory<T> memory, int size, string name)
719+
public static void HasSizeGreaterThanOrEqualTo<T>(ReadOnlyMemory<T> memory, int size, string name)
721720
{
722721
if (memory.Length < size)
723722
{
724-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(memory, size, name);
723+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(memory, size, name);
725724
}
726725
}
727726

@@ -902,11 +901,11 @@ public static void HasSizeNotEqualTo<T>(T[] array, int size, string name)
902901
/// <param name="name">The name of the input parameter being tested.</param>
903902
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="array"/> is &lt;= <paramref name="size"/>.</exception>
904903
[MethodImpl(MethodImplOptions.AggressiveInlining)]
905-
public static void HasSizeOver<T>(T[] array, int size, string name)
904+
public static void HasSizeGreaterThan<T>(T[] array, int size, string name)
906905
{
907906
if (array.Length <= size)
908907
{
909-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(array, size, name);
908+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(array, size, name);
910909
}
911910
}
912911

@@ -919,11 +918,11 @@ public static void HasSizeOver<T>(T[] array, int size, string name)
919918
/// <param name="name">The name of the input parameter being tested.</param>
920919
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="array"/> is &lt; <paramref name="size"/>.</exception>
921920
[MethodImpl(MethodImplOptions.AggressiveInlining)]
922-
public static void HasSizeAtLeast<T>(T[] array, int size, string name)
921+
public static void HasSizeGreaterThanOrEqualTo<T>(T[] array, int size, string name)
923922
{
924923
if (array.Length < size)
925924
{
926-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(array, size, name);
925+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(array, size, name);
927926
}
928927
}
929928

@@ -1104,11 +1103,11 @@ public static void HasSizeNotEqualTo<T>(List<T> list, int size, string name)
11041103
/// <param name="name">The name of the input parameter being tested.</param>
11051104
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="list"/> is &lt;= <paramref name="size"/>.</exception>
11061105
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1107-
public static void HasSizeOver<T>(List<T> list, int size, string name)
1106+
public static void HasSizeGreaterThan<T>(List<T> list, int size, string name)
11081107
{
11091108
if (list.Count <= size)
11101109
{
1111-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver((ICollection<T>)list, size, name);
1110+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan((ICollection<T>)list, size, name);
11121111
}
11131112
}
11141113

@@ -1121,11 +1120,11 @@ public static void HasSizeOver<T>(List<T> list, int size, string name)
11211120
/// <param name="name">The name of the input parameter being tested.</param>
11221121
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="list"/> is &lt; <paramref name="size"/>.</exception>
11231122
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1124-
public static void HasSizeAtLeast<T>(List<T> list, int size, string name)
1123+
public static void HasSizeGreaterThanOrEqualTo<T>(List<T> list, int size, string name)
11251124
{
11261125
if (list.Count < size)
11271126
{
1128-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast((ICollection<T>)list, size, name);
1127+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo((ICollection<T>)list, size, name);
11291128
}
11301129
}
11311130

@@ -1306,11 +1305,11 @@ public static void HasSizeNotEqualTo<T>(ICollection<T> collection, int size, str
13061305
/// <param name="name">The name of the input parameter being tested.</param>
13071306
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="collection"/> is &lt;= <paramref name="size"/>.</exception>
13081307
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1309-
public static void HasSizeOver<T>(ICollection<T> collection, int size, string name)
1308+
public static void HasSizeGreaterThan<T>(ICollection<T> collection, int size, string name)
13101309
{
13111310
if (collection.Count <= size)
13121311
{
1313-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(collection, size, name);
1312+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(collection, size, name);
13141313
}
13151314
}
13161315

@@ -1323,11 +1322,11 @@ public static void HasSizeOver<T>(ICollection<T> collection, int size, string na
13231322
/// <param name="name">The name of the input parameter being tested.</param>
13241323
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="collection"/> is &lt; <paramref name="size"/>.</exception>
13251324
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1326-
public static void HasSizeAtLeast<T>(ICollection<T> collection, int size, string name)
1325+
public static void HasSizeGreaterThanOrEqualTo<T>(ICollection<T> collection, int size, string name)
13271326
{
13281327
if (collection.Count < size)
13291328
{
1330-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(collection, size, name);
1329+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(collection, size, name);
13311330
}
13321331
}
13331332

@@ -1508,11 +1507,11 @@ public static void HasSizeNotEqualTo<T>(IReadOnlyCollection<T> collection, int s
15081507
/// <param name="name">The name of the input parameter being tested.</param>
15091508
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="collection"/> is &lt;= <paramref name="size"/>.</exception>
15101509
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1511-
public static void HasSizeOver<T>(IReadOnlyCollection<T> collection, int size, string name)
1510+
public static void HasSizeGreaterThan<T>(IReadOnlyCollection<T> collection, int size, string name)
15121511
{
15131512
if (collection.Count <= size)
15141513
{
1515-
ThrowHelper.ThrowArgumentExceptionForHasSizeOver(collection, size, name);
1514+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThan(collection, size, name);
15161515
}
15171516
}
15181517

@@ -1525,11 +1524,11 @@ public static void HasSizeOver<T>(IReadOnlyCollection<T> collection, int size, s
15251524
/// <param name="name">The name of the input parameter being tested.</param>
15261525
/// <exception cref="ArgumentException">Thrown if the size of <paramref name="collection"/> is &lt; <paramref name="size"/>.</exception>
15271526
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1528-
public static void HasSizeAtLeast<T>(IReadOnlyCollection<T> collection, int size, string name)
1527+
public static void HasSizeGreaterThanOrEqualTo<T>(IReadOnlyCollection<T> collection, int size, string name)
15291528
{
15301529
if (collection.Count < size)
15311530
{
1532-
ThrowHelper.ThrowArgumentExceptionForHasSizeAtLeast(collection, size, name);
1531+
ThrowHelper.ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo(collection, size, name);
15331532
}
15341533
}
15351534

0 commit comments

Comments
 (0)