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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Diamond <injektilo@mono-cvs.ximian.com>2002-08-20 07:56:55 +0400
committerJason Diamond <injektilo@mono-cvs.ximian.com>2002-08-20 07:56:55 +0400
commitafa895fbfd8aed2cd84bb098ee281fabe802a2d4 (patch)
tree96e1a8869d99da42daff225affc419761950970b /mcs/class/System.XML/Test/XmlDocumentTests.cs
parent024977893477d676a81374819973b645f3c475f1 (diff)
Added implementation of and tests for GetElementsByTagName courtesy of Matt Hunter <xrkune@tconl.com>.
svn path=/trunk/mcs/; revision=6788
Diffstat (limited to 'mcs/class/System.XML/Test/XmlDocumentTests.cs')
-rw-r--r--mcs/class/System.XML/Test/XmlDocumentTests.cs36
1 files changed, 36 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/XmlDocumentTests.cs b/mcs/class/System.XML/Test/XmlDocumentTests.cs
index e44cfc9c869..427cc70091d 100644
--- a/mcs/class/System.XML/Test/XmlDocumentTests.cs
+++ b/mcs/class/System.XML/Test/XmlDocumentTests.cs
@@ -11,6 +11,8 @@
using System;
using System.Collections;
using System.Xml;
+using System.IO;
+using System.Text;
using NUnit.Framework;
@@ -527,6 +529,24 @@ namespace MonoTests.System.Xml
catch (Exception) {}
AssertEquals (1, element.ChildNodes.Count);
}
+
+ public void TestGetElementsByTagNameNoNameSpace ()
+ {
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
+ <author>Tom Clancy</author><price>6.95</price></book><book>
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
+ <price>9.95</price></book><Fluffer><Nutter><book>
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
+ <price>9.95</price></book></Nutter></Fluffer></library>";
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ XmlNodeList bookList = document.GetElementsByTagName ("book");
+ AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
+ }
+
public void TestInnerAndOuterXml ()
{
@@ -560,6 +580,22 @@ namespace MonoTests.System.Xml
AssertEquals (document.InnerXml, document.OuterXml);
}
+ public void TestLoadWithSystemIOStream ()
+ {
+ string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
+ <price>34.95</price></book><book><title>Bear and the Dragon</title>
+ <author>Tom Clancy</author><price>6.95</price></book><book>
+ <title>Bourne Identity</title><author>Robert Ludlum</author>
+ <price>9.95</price></book><Fluffer><Nutter><book>
+ <title>Bourne Ultimatum</title><author>Robert Ludlum</author>
+ <price>9.95</price></book></Nutter></Fluffer></library>";
+
+ MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
+ document = new XmlDocument ();
+ document.Load (memoryStream);
+ AssertEquals ("Not Loaded From IOStream", true, document.HasChildNodes);
+ }
+
public void TestLoadXmlCDATA ()
{
document.LoadXml ("<foo><![CDATA[bar]]></foo>");