Exemplo n.º 1
0
        public static ITestValidationContinuation ShouldHaveAnyValidationError <T>(this TestValidationResult <T> testValidationResult)
        {
            if (!testValidationResult.Errors.Any())
            {
                throw new ValidationTestException($"Expected at least one validation error, but none were found.");
            }

            return(TestValidationContinuation.Create(testValidationResult.Errors));
        }
Exemplo n.º 2
0
 public static void ShouldNotHaveError <T, TValue>(this TestValidationResult <T, TValue> testValidationResult) where T : class
 {
     testValidationResult.Which.ShouldNotHaveValidationError();
 }
Exemplo n.º 3
0
 public static IEnumerable <ValidationFailure> ShouldHaveError <T, TValue>(this TestValidationResult <T, TValue> testValidationResult) where T : class
 {
     return(testValidationResult.Which.ShouldHaveValidationError());
 }
Exemplo n.º 4
0
 public static void ShouldNotHaveAnyValidationErrors <T, TValue>(this TestValidationResult <T, TValue> testValidationResult) where T : class
 {
     // TODO: Remove the second generic for 9.0.
     ShouldNotHaveValidationError(testValidationResult.Errors, MatchAnyFailure);
 }
Exemplo n.º 5
0
        public static IEnumerable <ValidationFailure> ShouldHaveAnyValidationError <T, TValue>(this TestValidationResult <T, TValue> testValidationResult) where T : class
        {
            // TODO: Remove the second generic for 9.0.
            if (!testValidationResult.Errors.Any())
            {
                throw new ValidationTestException($"Expected at least one validation error, but none were found.");
            }

            return(testValidationResult.Errors);
        }
 public static void ShouldNotHaveAnyValidationErrors <T>(this TestValidationResult <T> testValidationResult) where T : class
 {
     ShouldNotHaveValidationError(testValidationResult.Errors, MatchAnyFailure, true);
 }
        public static IEnumerable <ValidationFailure> ShouldHaveAnyValidationError <T>(this TestValidationResult <T> testValidationResult) where T : class
        {
            if (!testValidationResult.Errors.Any())
            {
                throw new ValidationTestException($"Expected at least one validation error, but none were found.");
            }

            return(testValidationResult.Errors);
        }
 public ValidationResultTester(TestValidationResult <T, TValue> testValidationResult)
 {
     this.testValidationResult = testValidationResult;
 }