added ExceptionAssert.Between method
This commit is contained in:
1 parent
d9bb667351
commit
d42ebd7ea5
1 file changed
+5
@@ -44,6 +44,11 @@ namespace mbts.utils {
|
||||
throw new ArgumentException($"Must equal {value}.", name);
|
||||
}
|
||||
|
||||
public static void Between<T>(T argument, T minimum, T maximum, string name) where T : struct, IComparable<T> {
|
||||
if (argument.CompareTo(minimum) < 0 || argument.CompareTo(maximum) > 0)
|
||||
throw new ArgumentException($"Must be between {minimum} and {maximum}, inclusive (actually {argument}).", name);
|
||||
}
|
||||
|
||||
public static void GreaterThan<T>(T argument, T value, string name) where T : IComparable<T> {
|
||||
if (argument.CompareTo(value) <= 0)
|
||||
throw new ArgumentException($"Must be greater than {value}.", name);
|
||||
|
||||
Reference in new issue
Block a user