public void RepeatingList_WhenOverExtendsTheUnderlyingEnumerator_ExceptionThrown() { var list = new LoopingList <int>(new List <int> { 1, 2, 3 }); //another way you can test this is by using the underlying IEnumerator interface var enumerator = list.GetEnumerator(); for (int i = 0; i < 7; i++) { enumerator.MoveNext(); } }
public void LoopingList_UsingUnderlyingEnumerator_NeverThrowsException() { var list = new LoopingList <int>(new List <int> { 1, 2, 3 }); //another way you can test this is by using the underlying IEnumerator interface var newList = new List <int>(); var enumerator = list.GetEnumerator(); for (int i = 0; i < 100; i++) { newList.Add(enumerator.Current); enumerator.MoveNext(); } Assert.Equal(100, newList.Count); }