Exemplo n.º 1
0
		protected virtual void AssertIterator(IQueue4 queue, string[] data, int size)
		{
			IEnumerator iter = queue.Iterator();
			for (int idx = 0; idx < size; idx++)
			{
				Assert.IsTrue(iter.MoveNext(), "should be able to move in iteration #" + idx + " of "
					 + size);
				Assert.AreEqual(data[idx], iter.Current);
			}
			Assert.IsFalse(iter.MoveNext());
		}
Exemplo n.º 2
0
        public virtual void TestIteratorThrowsOnConcurrentModification()
        {
            object[]    elements = new object[] { "foo", "bar" };
            IQueue4     queue    = NewQueue(elements);
            IEnumerator iterator = queue.Iterator();

            Iterator4Assert.AssertNext("foo", iterator);
            queue.Add("baz");
            Assert.AreEqual("foo", iterator.Current, "accessing current element should be harmless"
                            );
            Assert.Expect(typeof(InvalidOperationException), new _ICodeBlock_31(iterator));
        }
Exemplo n.º 3
0
        protected virtual void AssertIterator(IQueue4 queue, string[] data, int size)
        {
            IEnumerator iter = queue.Iterator();

            for (int idx = 0; idx < size; idx++)
            {
                Assert.IsTrue(iter.MoveNext(), "should be able to move in iteration #" + idx + " of "
                              + size);
                Assert.AreEqual(data[idx], iter.Current);
            }
            Assert.IsFalse(iter.MoveNext());
        }
Exemplo n.º 4
0
 public virtual IEnumerator Iterator()
 {
     return(_queue.Iterator());
 }