/// <summary> /// Performs the validation test /// </summary> /// <returns></returns> protected override ColladaValidationException ValidateImpl() { // if the field is null, return an exception ColladaValidationException exception = null; if (testField.GetValue() == null) { exception = new ColladaValidationException( String.Format(exceptionFormat, "IsNull", testField.GetTypeName(), "a required element is null")); } return(exception); }
/// <summary> /// Performs the validation test /// </summary> /// <returns></returns> protected override ColladaValidationException ValidateImpl() { // get the string value string test_string = (testField.GetValue() as string); // if the value is null, return null // there is a specific null value validation test for checking this if (test_string == null) { return(null); } ColladaValidationException exception = null; if (test_string.Length == 0) { exception = new ColladaValidationException( String.Format(exceptionFormat, "EmptyString", testField.GetTypeName(), "a necessary strings length is zero")); } return(exception); }
/// <summary> /// Performs the validation test /// </summary> /// <returns></returns> protected override ColladaValidationException ValidateImpl() { // get the value of the field T value = (T)testField.GetValue(); // if the value is null, return null // there is a specific null value validation test for checking this if (value == null) { return(null); } // if the valid value list does not have the current value return an exception ColladaValidationException exception = null; if (!validValues.Contains(value)) { exception = new ColladaValidationException( String.Format(exceptionFormat, "HasValidValue", testField.GetTypeName(), "an element has an invalid value")); } return(exception); }