Exemple #1
0
 public static bool Validate(this IEdmModel root, ValidationRuleSet ruleSet, out IEnumerable <EdmError> errors)
 {
     EdmUtil.CheckArgumentNull <IEdmModel>(root, "root");
     EdmUtil.CheckArgumentNull <ValidationRuleSet>(ruleSet, "ruleSet");
     errors = InterfaceValidator.ValidateModelStructureAndSemantics(root, ruleSet);
     return(errors.FirstOrDefault <EdmError>() == null);
 }
        public void Throws_when_calling_validator_as_interface()
        {
            IValidator <TestType> validator = new InterfaceValidator();
            var test = new TestType {
                TestInt = 0
            };

            Assert.Throws <ValidationException>(() => validator.ValidateAndThrow(test));
        }
 /// <summary>
 /// Gets the errors, if any, that belong to this type reference or its definition.
 /// </summary>
 /// <param name="type">The type reference.</param>
 /// <returns>Any errors that belong to this type reference or its definition.</returns>
 public static IEnumerable <EdmError> TypeErrors(this IEdmTypeReference type)
 {
     EdmUtil.CheckArgumentNull(type, "type");
     return(InterfaceValidator.GetStructuralErrors(type).Concat(InterfaceValidator.GetStructuralErrors(type.Definition)));
 }
 /// <summary>
 /// Gets the errors, if any, that belong to this element or elements that this element contains. For example errors for a structural type include the errors of the type itself and errors of its declared properties.
 /// The method does not analyze elements referenced by this element. For example errors of a property do not include errors from its type.
 /// </summary>
 /// <param name="element">Reference to the calling object.</param>
 /// <returns>Any errors that belong to this element or elements that element contains.</returns>
 public static IEnumerable <EdmError> Errors(this IEdmElement element)
 {
     EdmUtil.CheckArgumentNull(element, "element");
     return(InterfaceValidator.GetStructuralErrors(element));
 }