コード例 #1
0
 private static Exception VerifyFailRangeRequirement <T>(T _, string argumentName, FluentRangeVerificationCallback <T> evaluate, string expectedMessage = null)
 {
     expectedMessage = (expectedMessage ?? DefaultMessage).AssertNotNull().AssertNotEmpty();
     return(_.RequiresFailRange(argumentName, evaluate, () => expectedMessage));
 }
コード例 #2
0
 // TODO: TBD: `out of range´ of what? would it not be worth specifying in terms of at least an IEnumerable<T>?
 /// <summary>
 /// Throws an <see cref="ArgumentOutOfRangeException"/> when <paramref name="value"/>
 /// <paramref name="evaluate"/> returns false.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="value"></param>
 /// <param name="argumentName"></param>
 /// <param name="evaluate"></param>
 /// <param name="message"></param>
 /// <returns>Nothing. This method always throws.</returns>
 public static Exception RequiresFailRange <T>(this T value, string argumentName, FluentRangeVerificationCallback <T> evaluate, FluentMessageCallback message = null)
 => evaluate.Invoke(value) ? null : Requires.FailRange(argumentName, message.UseCallbackOrDefault().Invoke());