diff --git a/Code/Light.GuardClauses.Performance/StringAssertions/MustBeBenchmark.cs b/Code/Light.GuardClauses.Performance/StringAssertions/MustBeBenchmark.cs index 62310d7..19f51c5 100644 --- a/Code/Light.GuardClauses.Performance/StringAssertions/MustBeBenchmark.cs +++ b/Code/Light.GuardClauses.Performance/StringAssertions/MustBeBenchmark.cs @@ -22,6 +22,6 @@ public string ImperativeVersion() [Benchmark] public string LightGuardClausesCustomException() => - X.MustBe(Y, StringComparisonType.OrdinalIgnoreWhiteSpace, (x, y) => new Exception("The strings are not equal.")); + X.MustBe(Y, StringComparisonType.OrdinalIgnoreWhiteSpace, (_, _, _) => new Exception("The strings are not equal.")); } } \ No newline at end of file diff --git a/Code/Light.GuardClauses.Performance/StringAssertions/MustNotBeBenchmark.cs b/Code/Light.GuardClauses.Performance/StringAssertions/MustNotBeBenchmark.cs index 67f3c3c..3b5da46 100644 --- a/Code/Light.GuardClauses.Performance/StringAssertions/MustNotBeBenchmark.cs +++ b/Code/Light.GuardClauses.Performance/StringAssertions/MustNotBeBenchmark.cs @@ -25,6 +25,6 @@ public string ImperativeVersion() [Benchmark] public string LightGuardClausesCustomException() => - X.MustNotBe(Y, StringComparisonType.OrdinalIgnoreCaseIgnoreWhiteSpace, (x, y) => new Exception("The strings are equal.")); + X.MustNotBe(Y, StringComparisonType.OrdinalIgnoreCaseIgnoreWhiteSpace, (_, _, _) => new Exception("The strings are equal.")); } } \ No newline at end of file diff --git a/Code/Light.GuardClauses.Tests/StringAssertions/MustBeTests.cs b/Code/Light.GuardClauses.Tests/StringAssertions/MustBeTests.cs index 81b2285..6466858 100644 --- a/Code/Light.GuardClauses.Tests/StringAssertions/MustBeTests.cs +++ b/Code/Light.GuardClauses.Tests/StringAssertions/MustBeTests.cs @@ -50,7 +50,8 @@ public static void StringsNotEqualIgnoreWhiteSpace(string first, string second, public static void CustomException() => Test.CustomException("Foo", "Bar", - (x, y, exceptionFactory) => x.MustBe(y, StringComparison.Ordinal, exceptionFactory)); + StringComparison.Ordinal, + (x, y, ct, exceptionFactory) => x.MustBe(y, ct, exceptionFactory)); [Fact] public static void CustomMessage() => @@ -60,7 +61,8 @@ public static void CustomMessage() => public static void CustomExceptionIgnoreWhiteSpace() => Test.CustomException("Foo", " foo", - (x, y, exceptionFactory) => x.MustBe(y, StringComparisonType.OrdinalIgnoreWhiteSpace, exceptionFactory)); + StringComparisonType.OrdinalIgnoreWhiteSpace, + (x, y, ct, exceptionFactory) => x.MustBe(y, ct, exceptionFactory)); [Fact] public static void CustomMessageIgnoreWhiteSpace() => diff --git a/Code/Light.GuardClauses.Tests/StringAssertions/MustNotBeTests.cs b/Code/Light.GuardClauses.Tests/StringAssertions/MustNotBeTests.cs index 6d6f28a..b412c7c 100644 --- a/Code/Light.GuardClauses.Tests/StringAssertions/MustNotBeTests.cs +++ b/Code/Light.GuardClauses.Tests/StringAssertions/MustNotBeTests.cs @@ -56,7 +56,8 @@ public static void CustomException() => public static void CustomExceptionIgnoreWhiteSpace() => Test.CustomException("Foo", " Foo", - (x, y, exceptionFactory) => x.MustNotBe(y, StringComparisonType.OrdinalIgnoreWhiteSpace, exceptionFactory)); + StringComparisonType.OrdinalIgnoreWhiteSpace, + (x, y, ct, exceptionFactory) => x.MustNotBe(y, ct, exceptionFactory)); [Fact] public static void CustomMessage() => diff --git a/Code/Light.GuardClauses/Check.StringAssertions.cs b/Code/Light.GuardClauses/Check.StringAssertions.cs index 4e8e433..e8fff60 100644 --- a/Code/Light.GuardClauses/Check.StringAssertions.cs +++ b/Code/Light.GuardClauses/Check.StringAssertions.cs @@ -155,10 +155,10 @@ public static string MustNotBeNullOrWhiteSpace([NotNull, ValidatedNotNull] this /// Your custom exception thrown when is not equal to . /// Thrown when is not a valid value from the enum. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static string? MustBe(this string? parameter, string? other, StringComparison comparisonType, Func exceptionFactory) + public static string? MustBe(this string? parameter, string? other, StringComparison comparisonType, Func exceptionFactory) { if (!string.Equals(parameter, other, comparisonType)) - Throw.CustomException(exceptionFactory, parameter, other); + Throw.CustomException(exceptionFactory, parameter, other, comparisonType); return parameter; } @@ -171,7 +171,7 @@ public static string MustNotBeNullOrWhiteSpace([NotNull, ValidatedNotNull] this /// The name of the parameter (optional). /// The message that will be passed to the resulting exception (optional). /// Thrown when is not equal to . - /// Thrown when is not a valid value from the enum. + /// Thrown when is not a valid value from the enum. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string? MustBe(this string? parameter, string? other, StringComparisonType comparisonType, [CallerArgumentExpression("parameter")] string? parameterName = null, string? message = null) { @@ -188,11 +188,11 @@ public static string MustNotBeNullOrWhiteSpace([NotNull, ValidatedNotNull] this /// The enum value specifying how the two strings should be compared. /// The delegate that creates your custom exception. and are passed to this delegate. /// Your custom exception thrown when is not equal to . - /// Thrown when is not a valid value from the enum. - public static string? MustBe(this string? parameter, string? other, StringComparisonType comparisonType, Func exceptionFactory) + /// Thrown when is not a valid value from the enum. + public static string? MustBe(this string? parameter, string? other, StringComparisonType comparisonType, Func exceptionFactory) { if (!parameter.Equals(other, comparisonType)) - Throw.CustomException(exceptionFactory, parameter, other); + Throw.CustomException(exceptionFactory, parameter, other, comparisonType); return parameter; } @@ -220,7 +220,7 @@ public static string MustNotBeNullOrWhiteSpace([NotNull, ValidatedNotNull] this /// The first string to be compared. /// The second string to be compared. /// The enum value specifying how the two strings should be compared. - /// The delegate that creates your custom exception. and are passed to this delegate. + /// The delegate that creates your custom exception. , , and are passed to this delegate. /// Your custom exception thrown when is equal to . /// Thrown when is not a valid value from the enum. [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -240,7 +240,7 @@ public static string MustNotBeNullOrWhiteSpace([NotNull, ValidatedNotNull] this /// The name of the parameter (optional). /// The message that will be passed to the resulting exception (optional). /// Thrown when is equal to . - /// Thrown when is not a valid value from the enum. + /// Thrown when is not a valid value from the enum. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static string? MustNotBe(this string? parameter, string? other, StringComparisonType comparisonType, [CallerArgumentExpression("parameter")] string? parameterName = null, string? message = null) { @@ -255,14 +255,14 @@ public static string MustNotBeNullOrWhiteSpace([NotNull, ValidatedNotNull] this /// The first string to be compared. /// The second string to be compared. /// The enum value specifying how the two strings should be compared. - /// The delegate that creates your custom exception. and are passed to this delegate. + /// The delegate that creates your custom exception. , , and are passed to this delegate. /// Your custom exception thrown when is equal to . - /// Thrown when is not a valid value from the enum. + /// Thrown when is not a valid value from the enum. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static string? MustNotBe(this string? parameter, string? other, StringComparisonType comparisonType, Func exceptionFactory) + public static string? MustNotBe(this string? parameter, string? other, StringComparisonType comparisonType, Func exceptionFactory) { if (parameter.Equals(other, comparisonType)) - Throw.CustomException(exceptionFactory, parameter, other); + Throw.CustomException(exceptionFactory, parameter, other, comparisonType); return parameter; } @@ -441,7 +441,7 @@ public static string MustNotContain([NotNull, ValidatedNotNull] this string? par /// /// The string to be checked. /// The string that must not be part of . - /// The delegate that creates your custom exception (optional). and are passed to this + /// The delegate that creates your custom exception (optional). and are passed to this delegate. /// /// Your custom exception thrown when contains , /// or when is null, @@ -693,7 +693,7 @@ public static string MustNotBeSubstringOf([NotNull, ValidatedNotNull] this strin /// The string to be checked. /// The other string that must not contain . /// One of the enumeration values that specifies the rules for the search. - /// The delegate that creates your custom exception. and are passed to this delegate. + /// The delegate that creates your custom exception. , , and are passed to this delegate. /// /// Your custom exception thrown when contains , /// or when is null, @@ -771,7 +771,7 @@ public static string MustStartWith( /// The string to be checked. /// The other string must start with. /// One of the enumeration values that specifies the rules for the search. - /// The delegate that creates your custom exception. and are passed to this delegate. + /// The delegate that creates your custom exception. , , and are passed to this delegate. /// /// Your custom exception thrown when does not start with , /// or when is null, @@ -855,7 +855,7 @@ public static string MustNotStartWith( /// The string to be checked. /// The other string that must not start with. /// One of the enumeration values that specifies the rules for the search. - /// The delegate that creates your custom exception. and are passed to this delegate. + /// The delegate that creates your custom exception. , , and are passed to this delegate. /// /// Your custom exception thrown when does not start with , /// or when is null, @@ -938,7 +938,7 @@ public static string MustEndWith( /// The string to be checked. /// The other string must end with. /// One of the enumeration values that specifies the rules for the search. - /// The delegate that creates your custom exception. and are passed to this delegate. + /// The delegate that creates your custom exception. , , and are passed to this delegate. /// /// Your custom exception thrown when does not end with , /// or when is null,