From: Owen R. <exo...@us...> - 2004-11-15 05:13:14
|
Update of /cvsroot/netreflector/NetReflector/src/NetReflector.Test/Generators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2560/src/NetReflector.Test/Generators Added Files: XsdGeneratorTest.cs Log Message: - working on XmlDocumentationGenerator - started Xsd generation for NetReflector - lots of FxCop inspired improvements --- NEW FILE: XsdGeneratorTest.cs --- using System; using System.IO; using System.Xml; using System.Xml.Schema; using Exortech.NetReflector.Generators; using NUnit.Framework; namespace Exortech.NetReflector.Test.Generators { [TestFixture] public class XsdGeneratorTest { [Test] public void ShouldGenerateASchemaToValidateTestClassXml() { NetReflectorTypeTable table = new NetReflectorTypeTable(); table.Add(typeof(TestClass)); table.Add(typeof(TestInnerClass)); XsdGenerator generator = new XsdGenerator(table); XmlSchema schema = generator.Generate(); // schema.Write(Console.Out); string xmlToValidate = TestClass.GetXml(DateTime.Today); // Console.Out.WriteLine("xmlToValidate = {0}", xmlToValidate); XmlValidatingReader reader = new XmlValidatingReader(new XmlTextReader(new StringReader(xmlToValidate))); reader.Schemas.Add(schema); reader.ValidationType = ValidationType.Schema; while (reader.Read()) {} } [Test, Ignore("Work on schema generation is still in progress.")] public void ShouldGenerateASchemaToValidateTestSubClassXml() { NetReflectorTypeTable table = new NetReflectorTypeTable(); table.Add(typeof(TestClass)); table.Add(typeof(TestInnerClass)); table.Add(typeof(TestSubClass)); XsdGenerator generator = new XsdGenerator(table); XmlSchema schema = generator.Generate(); // schema.Write(Console.Out); string xmlToValidate = TestClass.GetXmlWithSubClass(DateTime.Today); // Console.Out.WriteLine("xmlToValidate = {0}", xmlToValidate); XmlValidatingReader reader = new XmlValidatingReader(new XmlTextReader(new StringReader(xmlToValidate))); reader.Schemas.Add(schema); reader.ValidationType = ValidationType.Schema; while (reader.Read()) {} } } } |