Remove fixed testcases from known failures list.
[mono.git] / mcs / class / System.XML / Test / System.Xml.Schema / XmlSchemaSetTests.cs
1 //
2 // System.Xml.XmlSchemaSetTests.cs
3 //
4 // Author:
5 //      Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // (C) 2004 Novell Inc.
8 //
9 #if NET_2_0
10
11 using System;
12 using System.Collections;
13 using System.IO;
14 using System.Xml;
15 using System.Xml.Schema;
16 using NUnit.Framework;
17
18 namespace MonoTests.System.Xml
19 {
20         [TestFixture]
21         public class XmlSchemaSetTests
22         {
23                 [Test]
24                 public void Add ()
25                 {
26                         XmlSchemaSet ss = new XmlSchemaSet ();
27                         XmlDocument doc = new XmlDocument ();
28                         doc.LoadXml ("<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' />");
29                         ss.Add (null, new XmlNodeReader (doc)); // null targetNamespace
30                         ss.Compile ();
31
32                         // same document, different targetNamespace
33                         ss.Add ("ab", new XmlNodeReader (doc));
34
35                         // Add(null, xmlReader) -> targetNamespace in the schema
36                         doc.LoadXml ("<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:foo' />");
37                         ss.Add (null, new XmlNodeReader (doc));
38
39                         Assert.AreEqual (3, ss.Count);
40
41                         bool chameleon = false;
42                         bool ab = false;
43                         bool urnfoo = false;
44
45                         foreach (XmlSchema schema in ss.Schemas ()) {
46                                 if (schema.TargetNamespace == null)
47                                         chameleon = true;
48                                 else if (schema.TargetNamespace == "ab")
49                                         ab = true;
50                                 else if (schema.TargetNamespace == "urn:foo")
51                                         urnfoo = true;
52                         }
53                         Assert.IsTrue (chameleon, "chameleon schema missing");
54                         Assert.IsTrue (ab, "target-remapped schema missing");
55                         Assert.IsTrue (urnfoo, "target specified in the schema ignored");
56                 }
57
58                 [Test]
59                 [Ignore ("This behavior might be changed, since Add(XmlSchema) does not throw any exceptions, while this does.")]
60                 [ExpectedException (typeof (ArgumentException))]
61                 public void AddTwice ()
62                 {
63                         XmlSchemaSet ss = new XmlSchemaSet ();
64                         XmlDocument doc = new XmlDocument ();
65                         doc.LoadXml ("<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' />");
66                         ss.Add ("ab", new XmlNodeReader (doc));
67                         ss.Add ("ab", new XmlNodeReader (doc));
68                 }
69         }
70 }
71 #endif