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:
authorAtsushi Eno <atsushieno@gmail.com>2009-01-08 05:39:23 +0300
committerAtsushi Eno <atsushieno@gmail.com>2009-01-08 05:39:23 +0300
commitb9326e77b14a8ad9605c461507a2b87efdd85fbb (patch)
tree13a58c30e328af7a8193702650be03257cf7f545 /mcs/class/System.XML/Test
parent239350ac12e5fafebcfe90ea890eb5d1ce59c46a (diff)
2009-01-08 Atsushi Enomoto <atsushi@ximian.com>
* XmlReader.cs : ReadContentAsString() does not reject non-elements. ReadElementContentAsString() rejects non-content nodes. * XmlReaderCommonTests.cs : added test for ReadContentAsString() and ReadElementContentAsString() against certain node types. svn path=/trunk/mcs/; revision=122737
Diffstat (limited to 'mcs/class/System.XML/Test')
-rw-r--r--mcs/class/System.XML/Test/System.Xml/ChangeLog5
-rw-r--r--mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs28
2 files changed, 33 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/System.Xml/ChangeLog b/mcs/class/System.XML/Test/System.Xml/ChangeLog
index 5ae95eb4df1..5f1f8d6c014 100644
--- a/mcs/class/System.XML/Test/System.Xml/ChangeLog
+++ b/mcs/class/System.XML/Test/System.Xml/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-08 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlReaderCommonTests.cs : added test for ReadContentAsString()
+ and ReadElementContentAsString() against certain node types.
+
2008-12-09 Atsushi Enomoto <atsushi@ximian.com>
* XmlValidatingReaderTests.cs : added test for validating mixed
diff --git a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
index 95f30cf1a51..de28a8235b4 100644
--- a/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml/XmlReaderCommonTests.cs
@@ -1952,6 +1952,34 @@ namespace MonoTests.System.Xml
}
[Test]
+ public void ReadContentStringOnEndElement ()
+ {
+ XmlReader xr = XmlReader.Create (new StringReader ("<a>test</a>"));
+ xr.Read ();
+ xr.Read ();
+ xr.Read ();
+ AssertEquals (String.Empty, xr.ReadContentAsString ()); // does not fail, unlike at Element!
+ }
+
+ [Test]
+ public void ReadContentStringOnPI ()
+ {
+ XmlReader xr = XmlReader.Create (new StringReader ("<?pi ?><a>test</a>"));
+ xr.Read ();
+ AssertEquals (String.Empty, xr.ReadContentAsString ());
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))] // unlike ReadContentAsString()
+ public void ReadElementContentStringOnPI ()
+ {
+ XmlReader xr = XmlReader.Create (new StringReader ("<?pi ?><a>test</a>"));
+ xr.Read ();
+ AssertEquals (XmlNodeType.ProcessingInstruction, xr.NodeType);
+ xr.ReadElementContentAsString ();
+ }
+
+ [Test]
[ExpectedException (typeof (XmlException))]
public void ReadElementContentStringMixedContent ()
{