public void ValidatingAnnotationWithValidationInBaseClassOnPersonWithCustomValidationInBaseThrowsInvalidOperationException() { var person = new PersonWithCustomValidationInBase(); person.Name = "Edgar"; person.Description = "some description"; person.Age = 42; // property under test person.AnnotationWithValidationInBaseClass = "some contents that will fail"; var validationResults = new List <ValidationResult>(); var validationContext = new System.ComponentModel.DataAnnotations.ValidationContext(person); var result = false; result = Validator.TryValidateObject(person, validationContext, validationResults, true); }
public void ValidatingAnnotationWithValidationInBaseClassOnPersonWithCustomValidationInBaseThrowsInvalidOperationException() { var person = new PersonWithCustomValidationInBase(); person.Name = "Edgar"; person.Description = "some description"; person.Age = 42; // property under test person.AnnotationWithValidationInBaseClass = "some contents that will fail"; var validationResults = new List<ValidationResult>(); var validationContext = new System.ComponentModel.DataAnnotations.ValidationContext(person); var result = false; result = Validator.TryValidateObject(person, validationContext, validationResults, true); }