Пример #1
0
        public void SelectReturnsCopiesOfRecords()
        {
            var reader  = new DataReaderStub <int>(12, 34, 56, 78);
            var records = reader.Select(r => r).ToArray();

            Assert.Equal(12, records[0][0]);
            Assert.Equal(34, records[1][0]);
            Assert.Equal(56, records[2][0]);
            Assert.Equal(78, records[3][0]);
        }
Пример #2
0
        public void Select()
        {
            var reader = new DataReaderStub <int>(12, 34, 56, 78);

            var disposed = false;

            reader.Disposed += delegate { disposed = true; };

            using (var e = reader.Select(r => (int)r[0]))
            {
                Assert.NotNull(e);
                Assert.NotNull(e);
                Assert.True(e.MoveNext());
                Assert.Equal(12, e.Current);
                Assert.True(e.MoveNext());
                Assert.Equal(34, e.Current);
                Assert.True(e.MoveNext());
                Assert.Equal(56, e.Current);
                Assert.True(e.MoveNext());
                Assert.Equal(78, e.Current);
                Assert.False(e.MoveNext());
                Assert.True(disposed);
            }
        }