mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
* XmlSchemaTests.cs : fixed file path. Added more tests. * added XmlSchemaCollectionTests.cs and XmlSchemaDatatypeTests.cs (the latter one's purpose overlaps with XmlSchemaBuiltInDatatypeTests ;) svn path=/trunk/mcs/; revision=21639
75 lines
1.6 KiB
C#
Executable File
75 lines
1.6 KiB
C#
Executable File
//
|
|
// System.Xml.XmlSchemaCollectionTests.cs
|
|
//
|
|
// Author:
|
|
// Atsushi Enomoto <[email protected]>
|
|
//
|
|
// (C) 2002 Atsushi Enomoto
|
|
//
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Xml;
|
|
using System.Xml.Schema;
|
|
using NUnit.Framework;
|
|
|
|
namespace MonoTests.System.Xml
|
|
{
|
|
[TestFixture]
|
|
public class XmlSchemaCollectionTests : Assertion
|
|
{
|
|
private XmlSchema GetSchema (string path)
|
|
{
|
|
return XmlSchema.Read (new XmlTextReader (path), null);
|
|
}
|
|
|
|
private XmlQualifiedName QName (string name, string ns)
|
|
{
|
|
return new XmlQualifiedName (name, ns);
|
|
}
|
|
|
|
[Test]
|
|
public void TestAdd ()
|
|
{
|
|
XmlSchemaCollection col = new XmlSchemaCollection ();
|
|
XmlSchema schema = new XmlSchema ();
|
|
XmlSchemaElement elem = new XmlSchemaElement ();
|
|
elem.Name = "foo";
|
|
schema.Items.Add (elem);
|
|
schema.TargetNamespace = "urn:foo";
|
|
col.Add (schema);
|
|
col.Add (schema); // No problem !?
|
|
|
|
XmlSchema schema2 = new XmlSchema ();
|
|
schema2.Items.Add (elem);
|
|
schema2.TargetNamespace = "urn:foo";
|
|
col.Add (schema2); // No problem !!
|
|
|
|
schema.Compile (null);
|
|
col.Add (schema);
|
|
col.Add (schema); // Still no problem !!!
|
|
|
|
schema2.Compile (null);
|
|
col.Add (schema2);
|
|
|
|
schema = GetSchema ("Test/XmlFiles/xsd/3.xsd");
|
|
schema.Compile (null);
|
|
col.Add (schema);
|
|
|
|
schema2 = GetSchema ("Test/XmlFiles/xsd/3.xsd");
|
|
schema2.Compile (null);
|
|
col.Add (schema2);
|
|
}
|
|
|
|
[Test]
|
|
public void TestAddDoesCompilation ()
|
|
{
|
|
XmlSchema schema = new XmlSchema ();
|
|
Assert (!schema.IsCompiled);
|
|
XmlSchemaCollection col = new XmlSchemaCollection ();
|
|
col.Add (schema);
|
|
Assert (schema.IsCompiled);
|
|
}
|
|
}
|
|
}
|