Files
mono/mcs/class/System.XML/Test/System.Xml/XmlEntityTests.cs
T
Robert Jordan bd7622796a 2009-06-26 Robert Jordan <[email protected]>
* *.cs: Upgrade to new NUnit style.


svn path=/trunk/mcs/; revision=137010
2009-06-26 21:06:21 +00:00

50 lines
1.2 KiB
C#

//
// System.Xml.XmlEntityTests.cs
//
// Author: Atsushi Enomoto ([email protected])
//
// (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);
}
}
}