public static bool VerifyEnumerator(Stack<int>.Enumerator enumerator, int[] expectedValues) { bool retVal = true; int i = 0; while (enumerator.MoveNext()) { if (enumerator.Current != expectedValues[i]) return false; ++i; }; retVal = i == expectedValues.Length; return retVal; }