2009-12-01 Jb Evain <jbevain@novell.com>
authorJb Evain <jbevain@gmail.com>
Tue, 1 Dec 2009 18:20:48 +0000 (18:20 -0000)
committerJb Evain <jbevain@gmail.com>
Tue, 1 Dec 2009 18:20:48 +0000 (18:20 -0000)
* StackTest.cs: add a test ensuring that disposing the stack
enumerator prevents to iterate further.

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

mcs/class/System/Test/System.Collections.Generic/ChangeLog
mcs/class/System/Test/System.Collections.Generic/StackTest.cs

index 4e856a13dee19226b6304dd8269d959e0c3e110a..52a10f534d519e540a616569084ac79ef1033393 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-01  Jb Evain  <jbevain@novell.com>
+
+       * StackTest.cs: add a test ensuring that disposing the stack
+       enumerator prevents to iterate further.
+
+
 2009-11-25  Jb Evain  <jbevain@novell.com>
 
        * QueueTest.cs: add test for a specific combination of
index a20d01edcff8ee8d34d271b05a1fe162769be81c..6ccb40519186965969310af8383e4c0df92df575 100644 (file)
@@ -233,6 +233,19 @@ namespace MonoTests.System.Collections.Generic
                        }
                }
 
+               [Test]
+               public void DisposeEnumerator ()
+               {
+                       var stack = new Stack<int> ();
+                       stack.Push (1);
+                       stack.Push (2);
+
+                       var enumerator = stack.GetEnumerator ();
+                       Assert.IsTrue (enumerator.MoveNext ());
+                       enumerator.Dispose ();
+                       Assert.IsFalse (enumerator.MoveNext ());
+               }
+
                [Test]
                public void TrimExcessTest ()
                {