示例#1
0
        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();
        }
示例#2
0
        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.");
        }
示例#3
0
        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());
        }
示例#4
0
 /// <inheritdoc/>
 public IEnumerator <Local> GetEnumerator()
 {
     return(locals.GetEnumerator());
 }
示例#5
0
 public IEnumerator <CodedValue> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
示例#6
0
 public IEnumerator <ExerciseSegment> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
 public IEnumerator <VersionInformation> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
 public IEnumerator <string> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
示例#9
0
 public IEnumerator <Blob> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
 public IEnumerator <ItemFilter> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
示例#11
0
 /// <inheritdoc />
 public ThreadSafe.IEnumerator <Local> GetEnumerator()
 {
     return(locals.GetEnumerator());
 }
示例#12
0
 public IEnumerator <StructuredNameValue> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }
示例#13
0
 public IEnumerator <object> GetEnumerator()
 {
     return(m_items.GetEnumerator());
 }