Below is a complete list of validations that are included with the library. Optional parameters that allow you to specify custom exception messages are omitted for brevity.
All validations are documented using the XML documentation comments, so IntelliSense works but I haven't yet decided which tool to use for converting the XML output to HTML. Therefore there is no online documentation yet.
For ArgumentInfo<T> where T : class
and ArgumentInfo<T?> where T : struct
Null()
NotNull()
- When called for an argument ofT?
, returns an argument ofT
.
Static without type constraints:
NotAllNull(ArgumentInfo<T1>, ArgumentInfo<T2>)
NotAllNull(ArgumentInfo<T1>, ArgumentInfo<T2>, ArgumentInfo<T3>)
For ArgumentInfo<T>
Equal(T)
Equal(T, IEqualityComparer<T>)
NotEqual(T)
NotEqual(T, IEqualityComparer<T>)
For ArgumentInfo<T> where T : class
Same(T)
NotSame(T)
For ArgumentInfo<T|T?> where T : struct
Default()
NotDefault()
For ArgumentInfo<T> where T : IComparable<T>
Min(T)
Max(T)
GreaterThan(T)
LessThan(T)
InRange(T, T)
For ArgumentInfo<T|T?> where T : struct, IComparable<T>
Zero()
NotZero()
Positive()
NotPositive()
Negative()
NotNegative()
For ArgumentInfo<bool|bool?>
True()
False()
For ArgumentInfo<T> where T : IEnumerable
Empty()
NotEmpty()
Count(int)
NotCount(int)
MinCount(int)
MaxCount(int)
CountInRange(int, int)
Contains<TItem>(TItem)
Contains<TItem>(TItem, IEqualityComparer<TItem>)
DoesNotContain<TItem>(TItem)
DoesNotContain<TItem>(TItem, IEqualityComparer<TItem>)
ContainsNull()
DoesNotContainNull()
DoesNotContainDuplicate()
DoesNotContainDuplicate(IEqualityComparer<TItem>)
For ArgumentInfo<T>
In<TCollection>(TCollection)
In<TCollection>(TCollection, IEqualityComparer<T>)
NotIn<TCollection>(TCollection)
NotIn<TCollection>(TCollection, IEqualityComparer<T>)
For ArgumentInfo<string>
Empty()
NotEmpty()
WhiteSpace()
NotWhiteSpace()
Length(int)
NotLength(int)
MinLength(int)
MaxLength(int)
LengthInRange(int, int)
Equal(string, StringComparison)
NotEqual(string, StringComparison)
StartsWith(string)
StartsWith(string, StringComparison)
DoesNotStartWith(string)
DoesNotStartWith(string, StringComparison)
EndsWith(string)
EndsWith(string, StringComparison)
DoesNotEndWith(string)
DoesNotEndWith(string, StringComparison)
Matches(string)
Matches(string, TimeSpan)
Matches(Regex)
DoesNotMatch(string)
DoesNotMatch(string, TimeSpan)
DoesNotMatch(Regex)
For ArgumentInfo<DateTime|DateTime?>
KindSpecified()
KindUnspecified()
For ArgumentInfo<float|float?|double|double?>
NaN()
NotNaN()
Infinity()
NotInfinity()
PositiveInfinity()
NotPositiveInfinity()
NegativeInfinity()
NotNegativeInfinity()
Equal(T, T)
- Approx. equality.NotEqual(T, T)
- Approx. unequality.
For ArgumentInfo<Uri>
Absolute
Relative
Scheme(string)
NotScheme(string)
Http()
Http(bool)
Https()
For ArgumentInfo<T|T?> where T : struct, Enum
Defined()
HasFlag(T)
DoesNotHaveFlag(T)
For ArgumentInfo<MailAddress>
HasHost(string)
DoesNotHaveHost(string)
HostIn(IEnumerable<string>)
HostNotIn(IEnumerable<string>)
HasDisplayName()
DoesNotHaveDisplayName()
For ArgumentInfo<T>
Compatible<TTarget>()
NotCompatible<TTarget>()
Cast<TTarget>
- Returns an argument ofTTarget
For ArgumentInfo<object>
Type<T>()
- Returns an argument ofT
.NotType<T>()
Type(Type)
NotType(Type)
For ArgumentInfo<T>
Member<TMember>(Expression<Func<T, TMember>>, Action<ArgumentInfo<TMember>>)
Member<TMember>(Expression<Func<T, TMember>>, Action<ArgumentInfo<TMember>>, bool)
For ArgumentInfo<T>
Modify<TTarget>(TTarget value)
- Returns an argument ofTTarget
Modify<TTarget>(Func<T, TTarget>)
- Returns an argument ofTTarget
Wrap<TTarget>(Func<T, TTarget>)
- Returns an argument ofTTarget
For ArgumentInfo<T> where T : class, ICloneable
Clone()
For ArgumentInfo<T>
Require(bool)
Require<TException>(bool)
Require(Func<T, bool>)
Require<TException>(Func<T, bool>)
For validating instance states instead of method arguments:
Operation(bool)
- ThrowsInvalidOperationException
forfalse
Support(bool)
- ThrowsNotSupportedException
forfalse
Disposal(bool, string)
- ThrowsObjectDisposedException
fortrue