Exemple #1
0
        public void GetEnumeratorTest()
        {
            // Arrange
            LimitedList <object> list = new LimitedList <object>(3);

            object[] objs = new object[] {
                new object(), new object(), new object(),
            };
            foreach (var item in objs)
            {
                list.Add(item);
            }

            // Act
            IEnumerator <object> enumerator = list.GetEnumerator();

            // Assert
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual(objs[0], enumerator.Current);
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual(objs[1], enumerator.Current);
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual(objs[2], enumerator.Current);
            Assert.IsFalse(enumerator.MoveNext());
        }
 public override IEnumerator <LogEntry> GetEnumerator()
 {
     return(entries.GetEnumerator());
 }