2009-07-09 Jb Evain <jbevain@novell.com>
authorJb Evain <jbevain@gmail.com>
Thu, 9 Jul 2009 19:11:23 +0000 (19:11 -0000)
committerJb Evain <jbevain@gmail.com>
Thu, 9 Jul 2009 19:11:23 +0000 (19:11 -0000)
* HashSetTest.cs: add test for #520760, ICollection<T>.Add
should not throw on duplicates.

svn path=/trunk/mcs/; revision=137652

mcs/class/System.Core/Test/System.Collections.Generic/ChangeLog
mcs/class/System.Core/Test/System.Collections.Generic/HashSetTest.cs

index 65aba54ad96b73ce859c6ccea156a2adb5dd0958..21d501f6983fe2383866e6ece3e3ddf05c22e82c 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-09  Jb Evain  <jbevain@novell.com>
+
+       * HashSetTest.cs: add test for #520760, ICollection<T>.Add
+       should not throw on duplicates.
+
 2008-12-17  Jb Evain  <jbevain@novell.com>
 
        * HashSetTest.cs: add test for CopyTo.
index 527fd23cfda954e8d5e6b88964909ab328c2cae7..58ca811d97f390ea570eab8130cedb46574d93ae 100644 (file)
@@ -335,6 +335,16 @@ namespace MonoTests.System.Collections.Generic {
                        Assert.AreEqual (42, dest [6]);
                }
 
+               [Test]
+               public void TestICollection ()
+               {
+                       var set = new HashSet<int> () as ICollection<int>;
+                       set.Add (42);
+                       set.Add (42);
+
+                       Assert.AreEqual (2, set.Count);
+               }
+
                static void AssertContainsOnly<T> (IEnumerable<T> result, IEnumerable<T> data)
                {
                        Assert.AreEqual (result.Count (), data.Count ());