Microsoft.Protocols.TestSuites.MS_OUTSPS.S03_CheckListDefination.VerifyChoicesAndMappingsSchema C# (CSharp) Method

VerifyChoicesAndMappingsSchema() private method

A method used to verify the schema definition for CHOICES and MAPPINGS elements. If there are any errors, method will throw a schema validation exception.
private VerifyChoicesAndMappingsSchema ( XmlElement rawResponseOfGetList, string expectedFieldName ) : bool
rawResponseOfGetList System.Xml.XmlElement A parameter represents the raw response of GetList operation. This value could be get from "LastRawResponseXml" property of protocol adapter.
expectedFieldName string A parameter represents the name of the field definition which the method will look up the CHOICES and Mappings elements xml string.
return bool
        private bool VerifyChoicesAndMappingsSchema(XmlElement rawResponseOfGetList, string expectedFieldName)
        {
            // Extract the Choices and Mapping xml string from response of GetList operation.
            List<string> choicesAndMappingXmlstrings = this.GetChoicesAndMappingsXmlString(rawResponseOfGetList, expectedFieldName);

            // Verify the schema definition of Choices and Mapping elements.
            foreach (string elementXmlString in choicesAndMappingXmlstrings)
            {
                SchemaValidation.ValidateXml(this.Site, elementXmlString);
                if (SchemaValidation.ValidationResult != ValidationResult.Success)
                {
                    string validationErrorMessage = SchemaValidation.GenerateValidationResult();
                    throw new XmlSchemaValidationException(validationErrorMessage);
                }
            }

            // If there are no any schema validation exception thrown, return true.
            return true;
        }