2 // System.Xml.XmlSchemaCollectionTests.cs
5 // Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
7 // (C) 2002 Atsushi Enomoto
13 using System
.Xml
.Schema
;
14 using NUnit
.Framework
;
16 namespace MonoTests
.System
.Xml
19 public class XmlSchemaCollectionTests
: Assertion
21 private XmlSchema
GetSchema (string path
)
23 return XmlSchema
.Read (new XmlTextReader (path
), null);
26 private XmlQualifiedName
QName (string name
, string ns
)
28 return new XmlQualifiedName (name
, ns
);
32 public void TestAdd ()
34 XmlSchemaCollection col
= new XmlSchemaCollection ();
35 XmlSchema schema
= new XmlSchema ();
36 XmlSchemaElement elem
= new XmlSchemaElement ();
38 schema
.Items
.Add (elem
);
39 schema
.TargetNamespace
= "urn:foo";
41 col
.Add (schema
); // No problem !?
43 XmlSchema schema2
= new XmlSchema ();
44 schema2
.Items
.Add (elem
);
45 schema2
.TargetNamespace
= "urn:foo";
46 col
.Add (schema2
); // No problem !!
48 schema
.Compile (null);
50 col
.Add (schema
); // Still no problem !!!
52 schema2
.Compile (null);
55 schema
= GetSchema ("Test/XmlFiles/xsd/3.xsd");
56 schema
.Compile (null);
59 schema2
= GetSchema ("Test/XmlFiles/xsd/3.xsd");
60 schema2
.Compile (null);
65 public void TestAddDoesCompilation ()
67 XmlSchema schema
= new XmlSchema ();
68 Assert (!schema
.IsCompiled
);
69 XmlSchemaCollection col
= new XmlSchemaCollection ();
71 Assert (schema
.IsCompiled
);
75 public void TestGetEnumerator ()
77 new XmlSchemaCollection().GetEnumerator();