public void EnumerationOfEmpty() { using (ListOfOftenOne <GenericParameterHelper> .Enumerator enumerator = this.list.GetEnumerator()) { Assert.False(enumerator.MoveNext()); enumerator.Reset(); Assert.False(enumerator.MoveNext()); } }
public void EnumerateAndClear() { this.list.Add(new GenericParameterHelper(1)); using (ListOfOftenOne <GenericParameterHelper> .Enumerator enumerator = this.list.EnumerateAndClear()) { Assert.Empty(this.list.ToArray()); // The collection should have been cleared. Assert.True(enumerator.MoveNext()); Assert.Equal(1, enumerator.Current.Data); Assert.False(enumerator.MoveNext()); } }
public void EnumerationOfOne() { this.list.Add(new GenericParameterHelper(1)); using (ListOfOftenOne <GenericParameterHelper> .Enumerator enumerator = this.list.GetEnumerator()) { Assert.True(enumerator.MoveNext()); Assert.Equal <int>(1, enumerator.Current.Data); Assert.False(enumerator.MoveNext()); enumerator.Reset(); Assert.True(enumerator.MoveNext()); Assert.Equal <int>(1, enumerator.Current.Data); Assert.False(enumerator.MoveNext()); } }