Beispiel #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));
        }
Beispiel #2
0
 public static void ShouldNotHaveError <T, TValue>(this TestValidationResult <T, TValue> testValidationResult) where T : class
 {
     testValidationResult.Which.ShouldNotHaveValidationError();
 }
Beispiel #3
0
 public static IEnumerable <ValidationFailure> ShouldHaveError <T, TValue>(this TestValidationResult <T, TValue> testValidationResult) where T : class
 {
     return(testValidationResult.Which.ShouldHaveValidationError());
 }
Beispiel #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);
 }
Beispiel #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;
 }