Welcome to mirror list, hosted at ThFree Co, Russian Federation.

XmlEntityTests.cs « System.Xml « Test « System.XML « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ca778b28018afb5d8876753f72ad6cf3ccd8096f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// System.Xml.XmlEntityTests.cs
//
// Author: Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
//
// (C) 2003 Atsushi Enomoto
//

using System;
using System.Xml;

using NUnit.Framework;

namespace MonoTests.System.Xml
{
	[TestFixture]
	public class XmlEntityTests
	{
		XmlDocument document;
		XmlDocumentType docType;

		[SetUp]
		public void GetReady ()
		{
			document = new XmlDocument ();
			docType = document.CreateDocumentType ("book", null, null, "<!ELEMENT book ANY>");
			document.AppendChild (docType);
		}

		[Test]
		public void TestValue ()
		{
			XmlTextReader xtr = new XmlTextReader ("<!DOCTYPE x:foo [<!ENTITY foo 'fooent'><!ENTITY bar 'test &foo;'>]><x:foo xmlns:x='hoge' />", XmlNodeType.Document, null);
			document.Load (xtr);
			xtr.Close ();
			docType = document.DocumentType;
			Assert.AreEqual (2, docType.Entities.Count);
			XmlEntity foo = docType.Entities.Item (0) as XmlEntity;
			XmlEntity bar = docType.Entities.Item (1) as XmlEntity;
			Assert.AreEqual ("foo", foo.Name);
			Assert.IsNull (bar.Value);
			Assert.AreEqual (1, foo.ChildNodes.Count);
			Assert.AreEqual ("bar", bar.Name);
			Assert.IsNull (bar.Value);
			Assert.AreEqual (1, foo.ChildNodes.Count);
		}
	       
	}
}