public void ReflectionAttributeTest() { Type type = null; // TODO: Initialize to an appropriate value string propertyName = string.Empty; // TODO: Initialize to an appropriate value Validator expected = null; // TODO: Initialize to an appropriate value Validator actual; actual = ReflcationClassProperty.GetValidator(type, propertyName); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
public void GetValidatorTest() { Type type = typeof(Person); string propertyName = "Name"; // TODO: Initialize to an appropriate value Validator expected = new AndCompositeValidator(new NotNullValidator()); // TODO: Initialize to an appropriate value Validator actual; actual = ReflcationClassProperty.GetValidator(type, propertyName); Assert.IsTrue(actual is AndCompositeValidator); var actualValidator = actual as AndCompositeValidator; var children = new List <Validator>(actualValidator.ListValidator); Assert.IsTrue(children.Count == 1); Assert.IsTrue(children[0] is NotNullValidator); }
protected string CheckValidation(string pName) { var type = this.GetType(); var p = type.GetProperty(pName); var value = p.GetValue(this, null); var validator = ReflcationClassProperty.GetValidator(type, pName); var result = validator.isValid(value); if (!result.Isvalid) { return(result.GetValidationResult(0).Message); } return(null); }