Example #1
0
        public void Validate_HasErrors_ValidationFails()
        {
            var expectedError     = new ExecutionError(AnnotationErrorCodes.Required, nameof(Validate_HasErrors_ValidationFails));
            var validatableObject = new FakeValidatableObject(new[] { expectedError });

            var result = (FailedResult)RecursiveValidator.Validate(validatableObject);
            var error  = result.Details.Single();

            error.Code.Should().Be(expectedError.Code);
            error.Source.Should().Be($"{nameof(FakeValidatableObject)}.{expectedError.Source}");
        }
Example #2
0
        public void Validate_NoErrors_ValidationSucceeds()
        {
            var validatableObject = new FakeValidatableObject(Array.Empty <ExecutionError>());

            RecursiveValidator.Validate(validatableObject).Success.Should().BeTrue();
        }