Update the tests to do actual verification
authorAlan McGovern <alan.mcgovern@gmail.com>
Fri, 20 Jul 2012 15:35:57 +0000 (16:35 +0100)
committerAlan McGovern <alan.mcgovern@gmail.com>
Fri, 20 Jul 2012 15:41:05 +0000 (16:41 +0100)
Ensure the elements really are added twice.

mcs/class/System.Xml.Linq/Test/System.Xml.Linq/XElementTest.cs

index 7f38d8feb85824340afaeeec6223510650528b92..e5cb66bc67dca0050132de635cad8c60a378eea7 100644 (file)
@@ -1662,10 +1662,13 @@ namespace MonoTests.System.Xml.Linq
                {
                        XElement root = new XElement (XName.Get ("Root", ""));
                        XElement child = new XElement (XName.Get ("Child", ""));
-
+                       
                        root.Add (child);
                        root.Add (child);
-                       root.ToString ();
+                       Assert.AreEqual(2, root.Elements().Count(), "#1");
+                       child.Remove ();
+                       Assert.AreEqual(1, root.Elements().Count(), "#2");
+                       AssertThrows<InvalidOperationException>(() => child.Remove(), "#3");
                }
 
                [Test]
@@ -1677,7 +1680,7 @@ namespace MonoTests.System.Xml.Linq
 
                        root.Add (attr);
                        root.Add (attr); // duplicate attribute
-                       root.ToString ();
+                       Assert.AreEqual(2, root.Attributes().Count(), "#1");
                }
 
                [Test]