2009-06-12 Bill Holmes <billholmes54@gmail.com>
[mono.git] / mcs / class / System.XML / Test / System.Xml / XmlEntityTests.cs
1 //
2 // System.Xml.XmlEntityTests.cs
3 //
4 // Author: Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
5 //
6 // (C) 2003 Atsushi Enomoto
7 //
8
9 using System;
10 using System.Xml;
11
12 using NUnit.Framework;
13
14 namespace MonoTests.System.Xml
15 {
16         [TestFixture]
17         public class XmlEntityTests : Assertion
18         {
19                 XmlDocument document;
20                 XmlDocumentType docType;
21
22                 [SetUp]
23                 public void GetReady ()
24                 {
25                         document = new XmlDocument ();
26                         docType = document.CreateDocumentType ("book", null, null, "<!ELEMENT book ANY>");
27                         document.AppendChild (docType);
28                 }
29
30                 [Test]
31                 public void TestValue ()
32                 {
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);
46                 }
47                
48         }
49 }