diff options
author | Kral Ferch <kral@mono-cvs.ximian.com> | 2002-03-18 06:11:17 +0300 |
---|---|---|
committer | Kral Ferch <kral@mono-cvs.ximian.com> | 2002-03-18 06:11:17 +0300 |
commit | 7472ae9d5d6c3dbcc4b8a6cd88d3537cca631b9a (patch) | |
tree | 982634ae808e7ad283a6ba617014f73587b38498 /mcs/class/System.XML/Test/XmlDocumentTests.cs | |
parent | 5b7629fbf350b66ceeb3273fb92ff0f6cd2e8851 (diff) |
More XmlTextWriter and node WriteTo.
svn path=/trunk/mcs/; revision=3176
Diffstat (limited to 'mcs/class/System.XML/Test/XmlDocumentTests.cs')
-rw-r--r-- | mcs/class/System.XML/Test/XmlDocumentTests.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/XmlDocumentTests.cs b/mcs/class/System.XML/Test/XmlDocumentTests.cs index 62035ed6442..dbb8b3e4a80 100644 --- a/mcs/class/System.XML/Test/XmlDocumentTests.cs +++ b/mcs/class/System.XML/Test/XmlDocumentTests.cs @@ -48,9 +48,21 @@ namespace Ximian.Mono.Tests public void TestLoadXMLComment() { +// XmlTextReader needs to throw this exception +// try { +// document.LoadXml("<!--foo-->"); +// Fail("XmlException should have been thrown."); +// } +// catch (XmlException e) { +// AssertEquals("Exception message doesn't match.", "The root element is missing.", e.Message); +// } + document.LoadXml ("<foo><!--Comment--></foo>"); Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Comment); AssertEquals ("Comment", document.DocumentElement.FirstChild.Value); + + document.LoadXml (@"<foo><!--bar--></foo>"); + AssertEquals ("Incorrect target.", "bar", ((XmlComment)document.FirstChild.FirstChild).Data); } public void TestLoadXmlElementSingle () @@ -108,5 +120,22 @@ namespace Ximian.Mono.Tests AssertEquals ("Incorrect target.", "foo", ((XmlProcessingInstruction)document.FirstChild).Target); AssertEquals ("Incorrect data.", "bar='baaz' quux='quuux'", ((XmlProcessingInstruction)document.FirstChild).Data); } + + public void TestOuterXml () + { + string xml; + + xml = "<root><![CDATA[foo]]></root>"; + document.LoadXml (xml); + AssertEquals("XmlDocument with cdata OuterXml is incorrect.", xml, document.OuterXml); + + xml = "<root><!--foo--></root>"; + document.LoadXml (xml); + AssertEquals("XmlDocument with comment OuterXml is incorrect.", xml, document.OuterXml); + + xml = "<root><?foo bar?></root>"; + document.LoadXml (xml); + AssertEquals("XmlDocument with processing instruction OuterXml is incorrect.", xml, document.OuterXml); + } } } |