Table of Contents

Class FormattableValidators<TResource>

Namespace
LfrlAnvil.Validation
Assembly
LfrlAnvil.Validation.dll

Creates instances of IValidator<T, TResult> type with ValidationMessage<TResource> result.

public static class FormattableValidators<TResource>

Type Parameters

TResource

Validator message's resource type.

Inheritance
FormattableValidators<TResource>
Inherited Members

Methods

ElementCountInRange<T>(int, int, ValidationMessage<TResource>)

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> ElementCountInRange<T>(int minCount, int maxCount, ValidationMessage<TResource> failureMessage)

Parameters

minCount int

Minimum expected number of elements.

maxCount int

Maximum expected number of elements.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New IsElementCountInRangeValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When minCount is not in [0, maxCount] range.

ElementCountInRange<T>(int, int, TResource)

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> ElementCountInRange<T>(int minCount, int maxCount, TResource resource)

Parameters

minCount int

Minimum expected number of elements.

maxCount int

Maximum expected number of elements.

resource TResource

Failure resource.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New IsElementCountInRangeValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When minCount is not in [0, maxCount] range.

Empty(ValidationMessage<TResource>)

Creates a new IsLengthExactValidator<TResult> instance with Length equal to 0.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> Empty(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsLengthExactValidator<TResult> instance.

Empty(TResource)

Creates a new IsLengthExactValidator<TResult> instance with Length equal to 0.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> Empty(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsLengthExactValidator<TResult> instance.

Empty<T>(ValidationMessage<TResource>)

Creates a new IsElementCountExactValidator<T, TResult> instance with Count equal to 0.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> Empty<T>(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New IsElementCountExactValidator<T, TResult> instance.

Type Parameters

T

Element type.

Empty<T>(TResource)

Creates a new IsElementCountExactValidator<T, TResult> instance with Count equal to 0.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> Empty<T>(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New IsElementCountExactValidator<T, TResult> instance.

Type Parameters

T

Element type.

EqualTo<T>(T, ValidationMessage<TResource>)

Creates a new IsEqualToValidator<T, TResult> instance with Default equality comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> EqualTo<T>(T determinant, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

EqualTo<T>(T, IEqualityComparer<T>, ValidationMessage<TResource>)

Creates a new IsEqualToValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> EqualTo<T>(T determinant, IEqualityComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

comparer IEqualityComparer<T>

Value equality comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

EqualTo<T>(T, IEqualityComparer<T>, TResource)

Creates a new IsEqualToValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> EqualTo<T>(T determinant, IEqualityComparer<T> comparer, TResource resource)

Parameters

determinant T

Value to compare with.

comparer IEqualityComparer<T>

Value equality comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

EqualTo<T>(T, TResource)

Creates a new IsEqualToValidator<T, TResult> instance with Default equality comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> EqualTo<T>(T determinant, TResource resource)

Parameters

determinant T

Value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

ExactElementCount<T>(int, ValidationMessage<TResource>)

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> ExactElementCount<T>(int count, ValidationMessage<TResource> failureMessage)

Parameters

count int

Expected exact number of elements.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New IsElementCountExactValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When count is less than 0.

ExactElementCount<T>(int, TResource)

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> ExactElementCount<T>(int count, TResource resource)

Parameters

count int

Expected exact number of elements.

resource TResource

Failure resource.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New IsElementCountExactValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When count is less than 0.

ExactLength(int, ValidationMessage<TResource>)

Creates a new IsLengthExactValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> ExactLength(int length, ValidationMessage<TResource> failureMessage)

Parameters

length int

Expected exact Length.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsLengthExactValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When length is less than 0.

ExactLength(int, TResource)

Creates a new IsLengthExactValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> ExactLength(int length, TResource resource)

Parameters

length int

Expected exact Length.

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsLengthExactValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When length is less than 0.

Fail<T>(ValidationMessage<TResource>)

Creates a new FailingValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> Fail<T>(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New FailingValidator<T, TResult> instance.

Type Parameters

T

Object type.

Fail<T>(TResource)

Creates a new FailingValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> Fail<T>(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New FailingValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThanOrEqualTo<T>(T, ValidationMessage<TResource>)

Creates a new IsGreaterThanOrEqualToValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThanOrEqualTo<T>(T determinant, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThanOrEqualTo<T>(T, IComparer<T>, ValidationMessage<TResource>)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThanOrEqualTo<T>(T determinant, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThanOrEqualTo<T>(T, IComparer<T>, TResource)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThanOrEqualTo<T>(T determinant, IComparer<T> comparer, TResource resource)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThanOrEqualTo<T>(T, TResource)

Creates a new IsGreaterThanOrEqualToValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThanOrEqualTo<T>(T determinant, TResource resource)

Parameters

determinant T

Value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThan<T>(T, ValidationMessage<TResource>)

Creates a new IsGreaterThanValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThan<T>(T determinant, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThan<T>(T, IComparer<T>, ValidationMessage<TResource>)

Creates a new IsGreaterThanValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThan<T>(T determinant, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThan<T>(T, IComparer<T>, TResource)

Creates a new IsGreaterThanValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThan<T>(T determinant, IComparer<T> comparer, TResource resource)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

GreaterThan<T>(T, TResource)

Creates a new IsGreaterThanValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> GreaterThan<T>(T determinant, TResource resource)

Parameters

determinant T

Value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsGreaterThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

InExclusiveRange<T>(T, T, ValidationMessage<TResource>)

Creates a new IsInExclusiveRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InExclusiveRange<T>(T min, T max, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InExclusiveRange<T>(T, T, IComparer<T>, ValidationMessage<TResource>)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InExclusiveRange<T>(T min, T max, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InExclusiveRange<T>(T, T, IComparer<T>, TResource)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InExclusiveRange<T>(T min, T max, IComparer<T> comparer, TResource resource)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InExclusiveRange<T>(T, T, TResource)

Creates a new IsInExclusiveRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InExclusiveRange<T>(T min, T max, TResource resource)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InRange<T>(T, T, ValidationMessage<TResource>)

Creates a new IsInRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InRange<T>(T min, T max, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InRange<T>(T, T, IComparer<T>, ValidationMessage<TResource>)

Creates a new IsInRangeValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InRange<T>(T min, T max, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InRange<T>(T, T, IComparer<T>, TResource)

Creates a new IsInRangeValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InRange<T>(T min, T max, IComparer<T> comparer, TResource resource)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

InRange<T>(T, T, TResource)

Creates a new IsInRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> InRange<T>(T min, T max, TResource resource)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

LengthInRange(int, int, ValidationMessage<TResource>)

Creates a new IsLengthInRangeValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> LengthInRange(int minLength, int maxLength, ValidationMessage<TResource> failureMessage)

Parameters

minLength int

Minimum expected Length.

maxLength int

Maximum expected Length.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsLengthInRangeValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When minLength is not in [0, maxLength] range.

LengthInRange(int, int, TResource)

Creates a new IsLengthInRangeValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> LengthInRange(int minLength, int maxLength, TResource resource)

Parameters

minLength int

Minimum expected Length.

maxLength int

Maximum expected Length.

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsLengthInRangeValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When minLength is not in [0, maxLength] range.

LessThanOrEqualTo<T>(T, ValidationMessage<TResource>)

Creates a new IsLessThanOrEqualToValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThanOrEqualTo<T>(T determinant, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThanOrEqualTo<T>(T, IComparer<T>, ValidationMessage<TResource>)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThanOrEqualTo<T>(T determinant, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThanOrEqualTo<T>(T, IComparer<T>, TResource)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThanOrEqualTo<T>(T determinant, IComparer<T> comparer, TResource resource)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThanOrEqualTo<T>(T, TResource)

Creates a new IsLessThanOrEqualToValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThanOrEqualTo<T>(T determinant, TResource resource)

Parameters

determinant T

Value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanOrEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThan<T>(T, ValidationMessage<TResource>)

Creates a new IsLessThanValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThan<T>(T determinant, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThan<T>(T, IComparer<T>, ValidationMessage<TResource>)

Creates a new IsLessThanValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThan<T>(T determinant, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThan<T>(T, IComparer<T>, TResource)

Creates a new IsLessThanValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThan<T>(T determinant, IComparer<T> comparer, TResource resource)

Parameters

determinant T

Value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

LessThan<T>(T, TResource)

Creates a new IsLessThanValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> LessThan<T>(T determinant, TResource resource)

Parameters

determinant T

Value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsLessThanValidator<T, TResult> instance.

Type Parameters

T

Object type.

Match(Regex, ValidationMessage<TResource>)

Creates a new IsRegexMatchedValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> Match(Regex regex, ValidationMessage<TResource> failureMessage)

Parameters

regex Regex

Regex to match.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsRegexMatchedValidator<TResult> instance.

Match(Regex, TResource)

Creates a new IsRegexMatchedValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> Match(Regex regex, TResource resource)

Parameters

regex Regex

Regex to match.

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsRegexMatchedValidator<TResult> instance.

MaxElementCount<T>(int, ValidationMessage<TResource>)

Creates a new MaxElementCountValidator<T, TResult> instance.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> MaxElementCount<T>(int maxCount, ValidationMessage<TResource> failureMessage)

Parameters

maxCount int

Expected maximum number of elements.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New MaxElementCountValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When maxCount is less than 0.

MaxElementCount<T>(int, TResource)

Creates a new MaxElementCountValidator<T, TResult> instance.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> MaxElementCount<T>(int maxCount, TResource resource)

Parameters

maxCount int

Expected maximum number of elements.

resource TResource

Failure resource.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New MaxElementCountValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When maxCount is less than 0.

MaxLength(int, ValidationMessage<TResource>)

Creates a new MaxLengthValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> MaxLength(int maxLength, ValidationMessage<TResource> failureMessage)

Parameters

maxLength int

Expected maximum Length.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New MaxLengthValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When maxLength is less than 0.

MaxLength(int, TResource)

Creates a new MaxLengthValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> MaxLength(int maxLength, TResource resource)

Parameters

maxLength int

Expected maximum Length.

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New MaxLengthValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When maxLength is less than 0.

MinElementCount<T>(int, ValidationMessage<TResource>)

Creates a new MinElementCountValidator<T, TResult> instance.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> MinElementCount<T>(int minCount, ValidationMessage<TResource> failureMessage)

Parameters

minCount int

Expected minimum number of elements.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New MinElementCountValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When minCount is less than 0.

MinElementCount<T>(int, TResource)

Creates a new MinElementCountValidator<T, TResult> instance.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> MinElementCount<T>(int minCount, TResource resource)

Parameters

minCount int

Expected minimum number of elements.

resource TResource

Failure resource.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New MinElementCountValidator<T, TResult> instance.

Type Parameters

T

Element type.

Exceptions

ArgumentOutOfRangeException

When minCount is less than 0.

MinLength(int, ValidationMessage<TResource>)

Creates a new MinLengthValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> MinLength(int minLength, ValidationMessage<TResource> failureMessage)

Parameters

minLength int

Expected minimum Length.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New MinLengthValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When minLength is less than 0.

MinLength(int, TResource)

Creates a new MinLengthValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> MinLength(int minLength, TResource resource)

Parameters

minLength int

Expected minimum Length.

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New MinLengthValidator<TResult> instance.

Exceptions

ArgumentOutOfRangeException

When minLength is less than 0.

NotEmpty(ValidationMessage<TResource>)

Creates a new MinLengthValidator<TResult> instance with MinLength equal to 1.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotEmpty(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New MinLengthValidator<TResult> instance.

NotEmpty(TResource)

Creates a new MinLengthValidator<TResult> instance with MinLength equal to 1.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotEmpty(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New MinLengthValidator<TResult> instance.

NotEmpty<T>(ValidationMessage<TResource>)

Creates a new MinElementCountValidator<T, TResult> instance with MinCount equal to 1.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> NotEmpty<T>(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New MinElementCountValidator<T, TResult> instance.

Type Parameters

T

Element type.

NotEmpty<T>(TResource)

Creates a new MinElementCountValidator<T, TResult> instance with MinCount equal to 1.

[Pure]
public static IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>> NotEmpty<T>(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<IReadOnlyCollection<T>, ValidationMessage<TResource>>

New MinElementCountValidator<T, TResult> instance.

Type Parameters

T

Element type.

NotEqualTo<T>(T, ValidationMessage<TResource>)

Creates a new IsNotEqualToValidator<T, TResult> instance with Default equality comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotEqualTo<T>(T determinant, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

NotEqualTo<T>(T, IEqualityComparer<T>, ValidationMessage<TResource>)

Creates a new IsNotEqualToValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotEqualTo<T>(T determinant, IEqualityComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

determinant T

Value to compare with.

comparer IEqualityComparer<T>

Value equality comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

NotEqualTo<T>(T, IEqualityComparer<T>, TResource)

Creates a new IsNotEqualToValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotEqualTo<T>(T determinant, IEqualityComparer<T> comparer, TResource resource)

Parameters

determinant T

Value to compare with.

comparer IEqualityComparer<T>

Value equality comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

NotEqualTo<T>(T, TResource)

Creates a new IsNotEqualToValidator<T, TResult> instance with Default equality comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotEqualTo<T>(T determinant, TResource resource)

Parameters

determinant T

Value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotEqualToValidator<T, TResult> instance.

Type Parameters

T

Object type.

NotInExclusiveRange<T>(T, T, ValidationMessage<TResource>)

Creates a new IsNotInExclusiveRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInExclusiveRange<T>(T min, T max, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInExclusiveRange<T>(T, T, IComparer<T>, ValidationMessage<TResource>)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInExclusiveRange<T>(T min, T max, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInExclusiveRange<T>(T, T, IComparer<T>, TResource)

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInExclusiveRange<T>(T min, T max, IComparer<T> comparer, TResource resource)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInExclusiveRange<T>(T, T, TResource)

Creates a new IsNotInExclusiveRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInExclusiveRange<T>(T min, T max, TResource resource)

Parameters

min T

Minimum exclusive value to compare with.

max T

Maximum exclusive value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInExclusiveRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInRange<T>(T, T, ValidationMessage<TResource>)

Creates a new IsNotInRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInRange<T>(T min, T max, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInRange<T>(T, T, IComparer<T>, ValidationMessage<TResource>)

Creates a new IsNotInRangeValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInRange<T>(T min, T max, IComparer<T> comparer, ValidationMessage<TResource> failureMessage)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

comparer IComparer<T>

Value comparer.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInRange<T>(T, T, IComparer<T>, TResource)

Creates a new IsNotInRangeValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInRange<T>(T min, T max, IComparer<T> comparer, TResource resource)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

comparer IComparer<T>

Value comparer.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotInRange<T>(T, T, TResource)

Creates a new IsNotInRangeValidator<T, TResult> instance with Default comparer.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotInRange<T>(T min, T max, TResource resource)

Parameters

min T

Minimum value to compare with.

max T

Maximum value to compare with.

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotInRangeValidator<T, TResult> instance.

Type Parameters

T

Object type.

Exceptions

ArgumentOutOfRangeException

When min is greater than max.

NotMatch(Regex, ValidationMessage<TResource>)

Creates a new IsRegexNotMatchedValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotMatch(Regex regex, ValidationMessage<TResource> failureMessage)

Parameters

regex Regex

Regex to not match.

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsRegexNotMatchedValidator<TResult> instance.

NotMatch(Regex, TResource)

Creates a new IsRegexNotMatchedValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotMatch(Regex regex, TResource resource)

Parameters

regex Regex

Regex to not match.

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsRegexNotMatchedValidator<TResult> instance.

NotMultiline(ValidationMessage<TResource>)

Creates a new IsNotMultilineValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotMultiline(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsNotMultilineValidator<TResult> instance.

NotMultiline(TResource)

Creates a new IsNotMultilineValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotMultiline(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsNotMultilineValidator<TResult> instance.

NotNull<T>(ValidationMessage<TResource>)

Creates a new IsNotNullValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotNull<T>(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotNullValidator<T, TResult> instance.

Type Parameters

T

Object type.

NotNull<T>(TResource)

Creates a new IsNotNullValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> NotNull<T>(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNotNullValidator<T, TResult> instance.

Type Parameters

T

Object type.

NotWhiteSpace(ValidationMessage<TResource>)

Creates a new IsNotWhiteSpaceValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotWhiteSpace(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsNotWhiteSpaceValidator<TResult> instance.

NotWhiteSpace(TResource)

Creates a new IsNotWhiteSpaceValidator<TResult> instance.

[Pure]
public static IValidator<string, ValidationMessage<TResource>> NotWhiteSpace(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<string, ValidationMessage<TResource>>

New IsNotWhiteSpaceValidator<TResult> instance.

Null<T>(ValidationMessage<TResource>)

Creates a new IsNullValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> Null<T>(ValidationMessage<TResource> failureMessage)

Parameters

failureMessage ValidationMessage<TResource>

Failure message.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNullValidator<T, TResult> instance.

Type Parameters

T

Object type.

Null<T>(TResource)

Creates a new IsNullValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> Null<T>(TResource resource)

Parameters

resource TResource

Failure resource.

Returns

IValidator<T, ValidationMessage<TResource>>

New IsNullValidator<T, TResult> instance.

Type Parameters

T

Object type.

Pass<T>()

Creates a new PassingValidator<T, TResult> instance.

[Pure]
public static IValidator<T, ValidationMessage<TResource>> Pass<T>()

Returns

IValidator<T, ValidationMessage<TResource>>

New PassingValidator<T, TResult> instance.

Type Parameters

T

Object type.