2007-11-05 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Mon, 5 Nov 2007 19:16:33 +0000 (19:16 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Mon, 5 Nov 2007 19:16:33 +0000 (19:16 -0000)
* ArrayTest.cs: Add test cases for Enumerator<T>.Reset (#322248).

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

mcs/class/corlib/Test/System/ArrayTest.cs
mcs/class/corlib/Test/System/ChangeLog

index 813ce1a8f4d8fde4938594b119221b76027bc669..176002610011246a8ecdf6bf57f7a6a96b509e13 100644 (file)
@@ -2898,5 +2898,31 @@ public class ArrayTest : Assertion
        }
 
        #endregion
+
+#if NET_2_0
+       // https://bugzilla.novell.com/show_bug.cgi?id=322248
+       [Test]
+       public void ResetMove ()
+       {
+               int[] array = new int[] { 1, 2, 3};
+               IEnumerator<int> e = ((IEnumerable<int>)array).GetEnumerator ();
+               // no exception is thrown
+               e.Reset ();
+               e.MoveNext ();
+               AssertEquals ("1", 1, e.Current);
+       }
+
+       [Test]
+       [ExpectedException (typeof (InvalidOperationException))]
+       public void MoveReset ()
+       {
+               int[] array = new int[] { 1, 2, 3 };
+               IEnumerator<int> e = ((IEnumerable<int>)array).GetEnumerator ();
+               e.MoveNext ();
+               e.Reset ();
+               // exception is thrown
+               AssertEquals ("1", 1, e.Current);
+       }
+#endif
 }
 }
index f8b521a52199362ecdd0aeb193a4457dbae682bd..e0aa396eadf06f7359a9bf2ce05500ccd7032a7f 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-05  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * ArrayTest.cs: Add test cases for Enumerator<T>.Reset (#322248).
+
 2007-11-05  Rodrigo Kumpera  <rkumpera@novell.com>
 
        * TypeTest.cs: Added tests for bug #331199.