ValidationTestExtension
Assembly: ServiceStack.dll
Declaration
public static class ValidationTestExtension
Methods
ShouldHaveValidationErrorFor<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, TValue, String)
Declaration
public static IEnumerable<ValidationFailure> ShouldHaveValidationErrorFor<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, TValue value, string ruleSet = null)
where T : class, new()
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type Parameters
ShouldHaveValidationErrorFor<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, T, String)
Declaration
public static IEnumerable<ValidationFailure> ShouldHaveValidationErrorFor<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, T objectToTest, string ruleSet = null)
where T : class
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type Parameters
ShouldNotHaveValidationErrorFor<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, TValue, String)
Declaration
public static void ShouldNotHaveValidationErrorFor<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, TValue value, string ruleSet = null)
where T : class, new()
Parameters
Type Parameters
ShouldNotHaveValidationErrorFor<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, T, String)
Declaration
public static void ShouldNotHaveValidationErrorFor<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, T objectToTest, string ruleSet = null)
where T : class
Parameters
Type Parameters
ShouldHaveValidationErrorForAsync<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, TValue, CancellationToken, String)
Declaration
public static async Task<IEnumerable<ValidationFailure>> ShouldHaveValidationErrorForAsync<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, TValue value, CancellationToken cancellationToken = default(CancellationToken), string ruleSet = null)
where T : class, new()
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>>
Parameters
Type | Name |
---|
ServiceStack.FluentValidation.IValidator<T> | validator |
System.Linq.Expressions.Expression<System.Func<<T>,<TValue>>> | expression |
<TValue> | value |
System.Threading.CancellationToken | cancellationToken |
System.String | ruleSet |
Type Parameters
ShouldHaveValidationErrorForAsync<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, T, CancellationToken, String)
Declaration
public static async Task<IEnumerable<ValidationFailure>> ShouldHaveValidationErrorForAsync<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, T objectToTest, CancellationToken cancellationToken = default(CancellationToken), string ruleSet = null)
where T : class
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>>
Parameters
Type | Name |
---|
ServiceStack.FluentValidation.IValidator<T> | validator |
System.Linq.Expressions.Expression<System.Func<<T>,<TValue>>> | expression |
<T> | objectToTest |
System.Threading.CancellationToken | cancellationToken |
System.String | ruleSet |
Type Parameters
ShouldNotHaveValidationErrorForAsync<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, TValue, CancellationToken, String)
Declaration
public static async Task ShouldNotHaveValidationErrorForAsync<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, TValue value, CancellationToken cancellationToken = default(CancellationToken), string ruleSet = null)
where T : class, new()
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
ServiceStack.FluentValidation.IValidator<T> | validator |
System.Linq.Expressions.Expression<System.Func<<T>,<TValue>>> | expression |
<TValue> | value |
System.Threading.CancellationToken | cancellationToken |
System.String | ruleSet |
Type Parameters
ShouldNotHaveValidationErrorForAsync<T, TValue>(IValidator<T>, Expression<Func<T, TValue>>, T, CancellationToken, String)
Declaration
public static async Task ShouldNotHaveValidationErrorForAsync<T, TValue>(this IValidator<T> validator, Expression<Func<T, TValue>> expression, T objectToTest, CancellationToken cancellationToken = default(CancellationToken), string ruleSet = null)
where T : class
Returns
System.Threading.Tasks.Task
Parameters
Type | Name |
---|
ServiceStack.FluentValidation.IValidator<T> | validator |
System.Linq.Expressions.Expression<System.Func<<T>,<TValue>>> | expression |
<T> | objectToTest |
System.Threading.CancellationToken | cancellationToken |
System.String | ruleSet |
Type Parameters
ShouldHaveChildValidator<T, TProperty>(IValidator<T>, Expression<Func<T, TProperty>>, Type)
Declaration
public static void ShouldHaveChildValidator<T, TProperty>(this IValidator<T> validator, Expression<Func<T, TProperty>> expression, Type childValidatorType)
Parameters
Type Parameters
TestValidate<T>(IValidator<T>, T, String)
Declaration
public static TestValidationResult<T> TestValidate<T>(this IValidator<T> validator, T objectToTest, string ruleSet = null)
where T : class
Returns
ServiceStack.FluentValidation.TestHelper.TestValidationResult<T>
Parameters
Type Parameters
TestValidateAsync<T>(IValidator<T>, T, CancellationToken, String)
Declaration
public static async Task<TestValidationResult<T>> TestValidateAsync<T>(this IValidator<T> validator, T objectToTest, CancellationToken cancellationToken = default(CancellationToken), string ruleSet = null)
where T : class
Returns
System.Threading.Tasks.Task<ServiceStack.FluentValidation.TestHelper.TestValidationResult<<T>>>
Parameters
Type Parameters
TestValidate<T>(IValidator<T>, T, Action<ValidationStrategy<T>>)
Declaration
public static TestValidationResult<T> TestValidate<T>(this IValidator<T> validator, T objectToTest, Action<ValidationStrategy<T>> options)
where T : class
Returns
ServiceStack.FluentValidation.TestHelper.TestValidationResult<T>
Parameters
Type Parameters
TestValidateAsync<T>(IValidator<T>, T, Action<ValidationStrategy<T>>, CancellationToken)
Declaration
public static async Task<TestValidationResult<T>> TestValidateAsync<T>(this IValidator<T> validator, T objectToTest, Action<ValidationStrategy<T>> options, CancellationToken cancellationToken = default(CancellationToken))
where T : class
Returns
System.Threading.Tasks.Task<ServiceStack.FluentValidation.TestHelper.TestValidationResult<<T>>>
Parameters
Type Parameters
ShouldHaveAnyValidationError<T>(TestValidationResult<T>)
Declaration
public static IEnumerable<ValidationFailure> ShouldHaveAnyValidationError<T>(this TestValidationResult<T> testValidationResult)
where T : class
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type Parameters
ShouldNotHaveAnyValidationErrors<T>(TestValidationResult<T>)
Declaration
public static void ShouldNotHaveAnyValidationErrors<T>(this TestValidationResult<T> testValidationResult)
where T : class
Parameters
Type Parameters
When(IEnumerable<ValidationFailure>, Func<ValidationFailure, Boolean>, String)
Declaration
public static IEnumerable<ValidationFailure> When(this IEnumerable<ValidationFailure> failures, Func<ValidationFailure, bool> failurePredicate, string exceptionMessage = null)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.Func<ServiceStack.FluentValidation.Results.ValidationFailure,System.Boolean> | failurePredicate |
System.String | exceptionMessage |
WhenAll(IEnumerable<ValidationFailure>, Func<ValidationFailure, Boolean>, String)
Declaration
public static IEnumerable<ValidationFailure> WhenAll(this IEnumerable<ValidationFailure> failures, Func<ValidationFailure, bool> failurePredicate, string exceptionMessage = null)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.Func<ServiceStack.FluentValidation.Results.ValidationFailure,System.Boolean> | failurePredicate |
System.String | exceptionMessage |
WithSeverity(IEnumerable<ValidationFailure>, Severity)
Declaration
public static IEnumerable<ValidationFailure> WithSeverity(this IEnumerable<ValidationFailure> failures, Severity expectedSeverity)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
WithCustomState(IEnumerable<ValidationFailure>, Object)
Declaration
public static IEnumerable<ValidationFailure> WithCustomState(this IEnumerable<ValidationFailure> failures, object expectedCustomState)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.Object | expectedCustomState |
WithMessageArgument<T>(IEnumerable<ValidationFailure>, String, T)
Declaration
public static IEnumerable<ValidationFailure> WithMessageArgument<T>(this IEnumerable<ValidationFailure> failures, string argumentKey, T argumentValue)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.String | argumentKey |
<T> | argumentValue |
Type Parameters
WithErrorMessage(IEnumerable<ValidationFailure>, String)
Declaration
public static IEnumerable<ValidationFailure> WithErrorMessage(this IEnumerable<ValidationFailure> failures, string expectedErrorMessage)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.String | expectedErrorMessage |
WithErrorCode(IEnumerable<ValidationFailure>, String)
Declaration
public static IEnumerable<ValidationFailure> WithErrorCode(this IEnumerable<ValidationFailure> failures, string expectedErrorCode)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.String | expectedErrorCode |
WithoutSeverity(IEnumerable<ValidationFailure>, Severity)
Declaration
public static IEnumerable<ValidationFailure> WithoutSeverity(this IEnumerable<ValidationFailure> failures, Severity unexpectedSeverity)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
WithoutCustomState(IEnumerable<ValidationFailure>, Object)
Declaration
public static IEnumerable<ValidationFailure> WithoutCustomState(this IEnumerable<ValidationFailure> failures, object unexpectedCustomState)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.Object | unexpectedCustomState |
WithoutErrorMessage(IEnumerable<ValidationFailure>, String)
Declaration
public static IEnumerable<ValidationFailure> WithoutErrorMessage(this IEnumerable<ValidationFailure> failures, string unexpectedErrorMessage)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.String | unexpectedErrorMessage |
WithoutErrorCode(IEnumerable<ValidationFailure>, String)
Declaration
public static IEnumerable<ValidationFailure> WithoutErrorCode(this IEnumerable<ValidationFailure> failures, string unexpectedErrorCode)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure> | failures |
System.String | unexpectedErrorCode |