* XmlSchemaAssertion.cs: Set eol-style to native.
[mono-project.git] / mcs / class / System.XML / Test / System.Xml.Schema / XmlSchemaCollectionTests.cs
blob27d5bc4a35af586af8859aac0b11870504a50169
1 //
2 // System.Xml.XmlSchemaCollectionTests.cs
3 //
4 // Author:
5 // Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
6 //
7 // (C) 2002 Atsushi Enomoto
8 //
10 using System;
11 using System.IO;
12 using System.Xml;
13 using System.Xml.Schema;
14 using NUnit.Framework;
16 namespace MonoTests.System.Xml
18 [TestFixture]
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);
31 [Test]
32 public void TestAdd ()
34 XmlSchemaCollection col = new XmlSchemaCollection ();
35 XmlSchema schema = new XmlSchema ();
36 XmlSchemaElement elem = new XmlSchemaElement ();
37 elem.Name = "foo";
38 schema.Items.Add (elem);
39 schema.TargetNamespace = "urn:foo";
40 col.Add (schema);
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);
49 col.Add (schema);
50 col.Add (schema); // Still no problem !!!
52 schema2.Compile (null);
53 col.Add (schema2);
55 schema = GetSchema ("Test/XmlFiles/xsd/3.xsd");
56 schema.Compile (null);
57 col.Add (schema);
59 schema2 = GetSchema ("Test/XmlFiles/xsd/3.xsd");
60 schema2.Compile (null);
61 col.Add (schema2);
64 [Test]
65 public void TestAddDoesCompilation ()
67 XmlSchema schema = new XmlSchema ();
68 Assert (!schema.IsCompiled);
69 XmlSchemaCollection col = new XmlSchemaCollection ();
70 col.Add (schema);
71 Assert (schema.IsCompiled);
74 [Test] // bug #75126
75 public void TestGetEnumerator ()
77 new XmlSchemaCollection().GetEnumerator();