**** Merged from MCS ****
[mono-project.git] / mcs / class / System.XML / Test / System.Xml / XmlEntityTests.cs
blobc90772ac1f4d58c48270dd286d6232558725be51
1 //
2 // System.Xml.XmlEntityTests.cs
3 //
4 // Author: Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
5 //
6 // (C) 2003 Atsushi Enomoto
7 //
9 using System;
10 using System.Xml;
12 using NUnit.Framework;
14 namespace MonoTests.System.Xml
16 [TestFixture]
17 public class XmlEntityTests : Assertion
19 XmlDocument document;
20 XmlDocumentType docType;
22 [SetUp]
23 public void GetReady ()
25 document = new XmlDocument ();
26 docType = document.CreateDocumentType ("book", null, null, "<!ELEMENT book ANY>");
27 document.AppendChild (docType);
30 [Test]
31 public void TestValue ()
33 XmlTextReader xtr = new XmlTextReader ("<!DOCTYPE x:foo [<!ENTITY foo 'fooent'><!ENTITY bar 'test &foo;'>]><x:foo xmlns:x='hoge' />", XmlNodeType.Document, null);
34 document.Load (xtr);
35 xtr.Close ();
36 docType = document.DocumentType;
37 AssertEquals (2, docType.Entities.Count);
38 XmlEntity foo = docType.Entities.Item (0) as XmlEntity;
39 XmlEntity bar = docType.Entities.Item (1) as XmlEntity;
40 AssertEquals ("foo", foo.Name);
41 AssertNull (bar.Value);
42 AssertEquals (1, foo.ChildNodes.Count);
43 AssertEquals ("bar", bar.Name);
44 AssertNull (bar.Value);
45 AssertEquals (1, foo.ChildNodes.Count);