diff options
author | Jason Diamond <injektilo@mono-cvs.ximian.com> | 2002-08-23 09:09:53 +0400 |
---|---|---|
committer | Jason Diamond <injektilo@mono-cvs.ximian.com> | 2002-08-23 09:09:53 +0400 |
commit | d0cd6199a50148579b6755b641fc9c13bba93597 (patch) | |
tree | ce055e94c94316b04f4c174b2d6eb7b5b77e3120 /mcs/class/System.XML/Test/XmlElementTests.cs | |
parent | db0e7930ea0a70dbcb582462fea71978eee2484a (diff) |
Implementation and tests for XmlAttributeCollection.RemoveAll and XmlElement.RemoveAllAttributes courtesy of Matt Hunter <xrkune@tconl.com>.
svn path=/trunk/mcs/; revision=6926
Diffstat (limited to 'mcs/class/System.XML/Test/XmlElementTests.cs')
-rw-r--r-- | mcs/class/System.XML/Test/XmlElementTests.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/XmlElementTests.cs b/mcs/class/System.XML/Test/XmlElementTests.cs index a8561f39373..83a45b1e45f 100644 --- a/mcs/class/System.XML/Test/XmlElementTests.cs +++ b/mcs/class/System.XML/Test/XmlElementTests.cs @@ -188,5 +188,22 @@ namespace MonoTests.System.Xml XmlElement element = document.CreateElement ("foo", "bar", "#foo"); AssertEquals ("<foo:bar xmlns:foo=\"#foo\" />", element.OuterXml); } + + public void TestRemoveAllAttributes () + { + StringBuilder xml = new StringBuilder (); + xml.Append ("<?xml version=\"1.0\" ?><library><book type=\"non-fiction\" price=\"34.95\"> "); + xml.Append ("<title type=\"intro\">XML Fun</title> " ); + xml.Append ("<author>John Doe</author></book></library>"); + + MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml.ToString ())); + document = new XmlDocument (); + document.Load (memoryStream); + XmlNodeList bookList = document.GetElementsByTagName ("book"); + XmlNode xmlNode = bookList.Item (0); + XmlElement xmlElement = xmlNode as XmlElement; + xmlElement.RemoveAllAttributes (); + AssertEquals ("attributes not properly removed.", false, xmlElement.HasAttribute ("type")); + } } } |