public void GetValue()
        {
            DataReaderDataSourceAdapter<IDataReader> adapter = new DataReaderDataSourceAdapter<IDataReader>(_reader);
            IDataReader reader = GetReaderAtRow(adapter, 1);

            object actual = adapter.GetValue(reader, new AdapterBoundField<IDataReader>("Name"));
            Assert.AreEqual("Mickey Mouse", actual);
        }
        public void GetValueNull()
        {
            DataReaderDataSourceAdapter<IDataReader> adapter = new DataReaderDataSourceAdapter<IDataReader>(_reader);
            IDataReader reader = GetReaderAtRow(adapter, 2);

            object actual = adapter.GetValue(reader, new AdapterBoundField<IDataReader>("Name"));
            Assert.IsNull(actual);
        }
        private IDataReader GetReaderAtRow(DataReaderDataSourceAdapter<IDataReader> adapter, int rowIndex)
        {
            IEnumerable enumerable = adapter.GetEnumerator();
            Assert.IsNotNull(enumerable);

            IEnumerator enumerator = enumerable.GetEnumerator();
            Assert.IsNotNull(enumerator);

            for (int i = 0; i < rowIndex; i++)
            {
                enumerator.MoveNext();
            }

            return enumerator.Current as IDataReader;
        }
        public void GetEnumerator()
        {
            DataReaderDataSourceAdapter<IDataReader> adapter = new DataReaderDataSourceAdapter<IDataReader>(_reader);
            IEnumerable enumerable = adapter.GetEnumerator();
            Assert.IsNotNull(enumerable);

            int i = 0;
            foreach (IDataReader reader in enumerable)
            {
                object[] row = GetRow(reader);
                CollectionAssert.AreEqual(_reader.Rows[i++], row);
            }

            Assert.AreEqual(4, i, "Should have read 4 rows.");
        }