AddResult() public méthode

public AddResult ( SchemaValidationResult result ) : void
result SchemaValidationResult
Résultat void
        private static bool ProcessPropertyInfo( object testSubject, SchemaValidationResult validationResults,
            PropertyInfo propertyInfo,
            Dictionary<string, XmlSchemaObject> xmlSchemaObjects, bool isValid)
        {
            string name = propertyInfo.Name;
            object oValue = propertyInfo.GetValue( testSubject, null );
            bool ok2Run = false;
            if (oValue != null)
            {
                MethodInfo mmi = oValue.GetType().GetMethod( "Validate" );
                var collection = oValue as ICollection;
                if (collection != null)
                {
                    //Need to get the type of each item schema
                    foreach (object obj in collection)
                    {
                        MethodInfo mi = obj.GetType().GetMethod( "Validate" );
                        if (mi != null)
                        {
                            var result = new SchemaValidationResult( name );
                            object[] p = {result};
                            try
                            {
                                mi.Invoke( obj, p );
                                object po = p[0];
                                validationResults.AddResult( result );
                            }
                            catch (Exception)
                            {
                                int i = 0;
                            }
                        }
                    }
                    ok2Run = true;
                }
                else if (mmi != null)
                {
                    var result = new SchemaValidationResult( name );
                    object[] p = {result};
                    mmi.Invoke( oValue, p );
                    validationResults.AddResult( result );
                    isValid = !result.HasErrors();
                }
                else
                {
                    ok2Run = true;
                }
            }
            else
            {
                ok2Run = true;
            }
            if (xmlSchemaObjects.ContainsKey( name ) && ok2Run)
            {
                string value = oValue != null ? oValue.ToString() : null;
                XmlSchemaObject schemaObject = xmlSchemaObjects[name];
                var attribute = schemaObject as XmlSchemaAttribute;
                var element = schemaObject as XmlSchemaElement;
                if (attribute != null)
                    isValid &= ValidateAttribute( attribute, value, validationResults );
                if (element != null)
                {
                    string ename = element.Name;
                    string enamespace = element.QualifiedName.Namespace;
                    bool isNillable = element.IsNillable;
                    isValid &= ValidateElement( element, oValue, validationResults );
                    var sct = element.ElementSchemaType as XmlSchemaComplexType;
                    if (sct != null)
                    {
                        //Validate(sct, o, errors);
                        int i = 0;
                    }

                    //Validate(enamespace, ename, o, errors);
                }
            }
            else
            {
                int i = 0;
            }
            return isValid;
        }
        public static bool ValidateComplexType( XmlSchemaComplexType complexType, object testSubject,
            SchemaValidationResult parentValidationResult)
        {
            bool isValid = true;
            var result = new SchemaValidationResult( testSubject.GetType().Name, testSubject );
            var xmlSchemaObjects = new Dictionary<string, XmlSchemaObject>();
            XmlSchemaContentModel contentModel = complexType.ContentModel;
            ExtractSequenceItems( complexType, xmlSchemaObjects );
            parentValidationResult.AddResult( result );

            if (contentModel != null)
                ExtractContentItems( contentModel, xmlSchemaObjects );

            ExtractAttributes( complexType, xmlSchemaObjects );

            PropertyInfo[] props = testSubject.GetType().GetProperties();
            foreach (PropertyInfo propertyInfo in props)
            {
                try
                {
                    isValid &= ProcessPropertyInfo( testSubject, result, propertyInfo, xmlSchemaObjects, isValid );
                }
                catch (Exception e)
                {
                    int i = 0;
                }
            }
            return result.HasErrors();
        }