/// <summary> /// Validates a session xml document. /// </summary> /// <param name="xdoc"></param> public static void ValidateSessionXml(XDocument xdoc, ValidationEventHandler validationHandler = null) { // First, make sure it's a testcase if (xdoc == null) { throw new ArgumentNullException("xdoc"); } if (xdoc.Root == null) { throw new ArgumentException("Xml document doesn't contain a root element.", "xdoc"); } if (xdoc.Root.Name != XSessionNames.Session) { throw new ArgumentException(String.Format("The root element should be \"{0}\" but is \"{1}\".", XSessionNames.Session, xdoc.Root.Name)); } XmlSchemaSet schemaSet = new XmlSchemaSet(); schemaSet.Add(UnitTestingSchemaUtil.GetConcurrencySchema()); schemaSet.Add(UnitTestingSchemaUtil.GetTestListSchema()); schemaSet.Add(UnitTestingSchemaUtil.GetChessSchema()); schemaSet.Add(XSessionUtil.GetSessionSchema()); schemaSet.Compile(); xdoc.Validate(schemaSet, validationHandler); }