public void SchemaValidateMarkupXML() { XmlSchema markupSchema = BCFTestsXMLHelper.GetSchema("markup.xsd"); XmlSerializer markupSerializer = new XmlSerializer(typeof(MarkupXMLFile)); XmlDocument markupXML = new XmlDocument(); using (MemoryStream stream = new MemoryStream()) { using (var xmlWriter = new StreamWriter(stream)) { markupSerializer.Serialize(xmlWriter, BCFTestsXMLHelper.BuildMarkupObject()); stream.Seek(0, SeekOrigin.Begin); markupXML.Load(stream); xmlWriter.Close(); } } xmlSchemaValidator.ValidXmlDoc(markupXML, markupSchema); Assert.IsTrue(xmlSchemaValidator.IsValidXml, "XML does not match Schema: " + xmlSchemaValidator.ValidationError); }
public void SchemaValidateVisualizationXML() { XmlSchema visualizationSchema = BCFTestsXMLHelper.GetSchema("visinfo.xsd"); XmlSerializer visualizationSerializer = new XmlSerializer(typeof(VisualizationXMLFile)); XmlDocument visualizationXML = new XmlDocument(); using (MemoryStream stream = new MemoryStream()) { using (var xmlWriter = new StreamWriter(stream)) { visualizationSerializer.Serialize(xmlWriter, BCFTestsXMLHelper.BuildVisualizationObject()); stream.Seek(0, SeekOrigin.Begin); visualizationXML.Load(stream); xmlWriter.Close(); } } xmlSchemaValidator.ValidXmlDoc(visualizationXML, visualizationSchema); Assert.IsTrue(xmlSchemaValidator.IsValidXml, "XML does not match Schema: " + xmlSchemaValidator.ValidationError); }
public void TestInit() { xmlSchemaValidator = new BCFTestsXMLHelper(); }