diff options
author | Matt Hunter <matthunt@mono-cvs.ximian.com> | 2002-09-21 08:21:44 +0400 |
---|---|---|
committer | Matt Hunter <matthunt@mono-cvs.ximian.com> | 2002-09-21 08:21:44 +0400 |
commit | afcfff04a2d0f22f31af389e56d9c4eb2454f446 (patch) | |
tree | b02ca844e2258fdcc5526beec06ee2c1c16e4f25 /mcs/class/System.XML | |
parent | 07aae53facdf9b4f8fe011bf0add6b7bda4560fe (diff) |
implementing tests: XmlElementTests.TestSetAttributeNode
and XmlAttributeCollectionTest.TestAppend
svn path=/trunk/mcs/; revision=7681
Diffstat (limited to 'mcs/class/System.XML')
-rw-r--r-- | mcs/class/System.XML/Test/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs | 13 | ||||
-rw-r--r-- | mcs/class/System.XML/Test/XmlElementTests.cs | 10 |
3 files changed, 28 insertions, 0 deletions
diff --git a/mcs/class/System.XML/Test/ChangeLog b/mcs/class/System.XML/Test/ChangeLog index f14e188f8f6..dff0dd11349 100644 --- a/mcs/class/System.XML/Test/ChangeLog +++ b/mcs/class/System.XML/Test/ChangeLog @@ -1,3 +1,8 @@ +2002-09-19 Matt Hunter <mahunter@tconl.com> + + * XmlElementTests.cs: Test for SetAttributeNode(localName, namespaceURI) added. + * XmlAttributeCollectionTests.cs: added TestAppend(). + 2002-09-17 Kral Ferch <kral_ferch@hotmail.com> * XPathNavigatorEvaluateTests.cs: Tests for string(), concat(), diff --git a/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs b/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs index 218691fccb8..9fdc8a9feac 100644 --- a/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs +++ b/mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs @@ -42,5 +42,18 @@ namespace MonoTests.System.Xml AssertEquals ("not all attributes removed.", false, xmlElement.HasAttribute ("type")); } + public void TestAppend () + { + XmlDocument xmlDoc = new XmlDocument ();
+ XmlElement xmlEl = xmlDoc.CreateElement ("TestElement");
+ XmlAttribute xmlAttribute = xmlEl.SetAttributeNode ("attr1", "namespace1");
+ XmlNode xmlNode = xmlDoc.CreateNode (XmlNodeType.Attribute, "attr3", "namespace1");
+ XmlAttribute xmlAttribute3 = xmlNode as XmlAttribute;
+ XmlAttributeCollection attributeCol = xmlEl.Attributes;
+ xmlAttribute3 = attributeCol.Append (xmlAttribute3);
+ AssertEquals ("attribute name not properly created.", true, xmlAttribute3.Name.Equals ("attr3"));
+ AssertEquals ("attribute namespace not properly created.", true, xmlAttribute3.NamespaceURI.Equals ("namespace1"));
+ } + } } diff --git a/mcs/class/System.XML/Test/XmlElementTests.cs b/mcs/class/System.XML/Test/XmlElementTests.cs index f0dca5c613b..9b7390294e9 100644 --- a/mcs/class/System.XML/Test/XmlElementTests.cs +++ b/mcs/class/System.XML/Test/XmlElementTests.cs @@ -205,5 +205,15 @@ namespace MonoTests.System.Xml xmlElement.RemoveAllAttributes (); AssertEquals ("attributes not properly removed.", false, xmlElement.HasAttribute ("type")); } + + public void TestSetAttributeNode()
+ {
+ XmlDocument xmlDoc = new XmlDocument ();
+ XmlElement xmlEl = xmlDoc.CreateElement ("TestElement");
+ XmlAttribute xmlAttribute = xmlEl.SetAttributeNode ("attr1", "namespace1");
+ XmlAttribute xmlAttribute2 = xmlEl.SetAttributeNode ("attr2", "namespace2");
+ AssertEquals ("attribute name not properly created.", true, xmlAttribute.Name.Equals ("attr1"));
+ AssertEquals ("attribute namespace not properly created.", true, xmlAttribute.NamespaceURI.Equals ("namespace1"));
+ } } } |