public void GivenLazyListWhenGetEnumeratorShouldLoad() { _lazyLoadResolverMock.Setup(x => x.Resolve(It.IsAny <LazyLoadParameter>())) .Returns(new[] { new Stub(), new Stub() }) .Verifiable(); var lazyList = new LazyList <Stub>(_lazyLoadResolverMock.Object); lazyList.GetEnumerator().Should().NotBeNull(); _lazyLoadResolverMock.VerifyAll(); }
public void ShouldEnumerateAllElementsIncrementally() { MockEnumerable source = new MockEnumerable(2); var list = new LazyList <int>(source); IEnumerator <int> enumerator = list.GetEnumerator(); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(0, enumerator.Current); Assert.AreEqual(1, source.TotalElementsReturned, "Should have read exactly the necessary number of elements."); Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(1, enumerator.Current); Assert.AreEqual(2, source.TotalElementsReturned, "Should have read exactly the necessary number of elements."); Assert.IsFalse(enumerator.MoveNext()); Assert.AreEqual(2, source.TotalElementsReturned, "Should have read exactly the necessary number of elements."); }
public void TestEnumerator() { List <object> l = new List <object>(); l.Add("a"); l.Add("b"); Assert.IsFalse(LazyList.GetEnumerator(null).MoveNext()); IEnumerator i = LazyList.GetEnumerator("a"); Assert.IsTrue(i.MoveNext()); Assert.AreEqual("a", i.Current); Assert.IsFalse(i.MoveNext()); i = LazyList.GetEnumerator(l); Assert.IsTrue(i.MoveNext()); Assert.AreEqual("a", i.Current); Assert.IsTrue(i.MoveNext()); Assert.AreEqual("b", i.Current); Assert.IsFalse(i.MoveNext()); }
/// <inheritdoc/> public IEnumerator <Local> GetEnumerator() { return(locals.GetEnumerator()); }
public IEnumerator <CodedValue> GetEnumerator() { return(m_items.GetEnumerator()); }
public IEnumerator <ExerciseSegment> GetEnumerator() { return(m_items.GetEnumerator()); }
public IEnumerator <VersionInformation> GetEnumerator() { return(m_items.GetEnumerator()); }
public IEnumerator <string> GetEnumerator() { return(m_items.GetEnumerator()); }
public IEnumerator <Blob> GetEnumerator() { return(m_items.GetEnumerator()); }
public IEnumerator <ItemFilter> GetEnumerator() { return(m_items.GetEnumerator()); }
/// <inheritdoc /> public ThreadSafe.IEnumerator <Local> GetEnumerator() { return(locals.GetEnumerator()); }
public IEnumerator <StructuredNameValue> GetEnumerator() { return(m_items.GetEnumerator()); }
public IEnumerator <object> GetEnumerator() { return(m_items.GetEnumerator()); }