[Test] public void ExtractDataWithRowMapper([Values(0, 2, 10)] int n)
        {
            for (int i = 0; i < n; i++)
            {
                Expect.Call(_dataReader.Read()).Return(true);
                _rowMapper.ProcessRow(_dataReader);
            }
            Expect.Call(_dataReader.Read()).Return(false);
            _mockery.ReplayAll();
            var testee = new ExtendedRowCallbackResultSetExtractor(_rowMapper);

            testee.ExtractData(_dataReader);
            _mockery.VerifyAll();
        }
Example #2
0
        /// <summary>
        /// All rows of the data reader are passed to the IRowCallback
        /// associated with this class.
        /// </summary>
        /// <param name="reader">The IDataReader to extract data from.
        /// Implementations should not close this: it will be closed
        /// by the AdoTemplate.</param>
        /// <returns>
        /// Null is returned since IRowCallback manages its own state.
        /// </returns>
        public object ExtractData(IDataReader reader)
        {
            if (rowCallback != null)
            {
                while (reader.Read())
                {
                    rowCallback.ProcessRow(reader);
                }
            }
            else
            {
                while (reader.Read())
                {
                    rowCallbackDelegate(reader);
                }
            }

            return(null);
        }
        /// <summary>
        /// All rows of the data reader are passed to the <see cref="IRowCallback"/>
        /// or <see cref="RowCallbackDelegate"/> associated with this class.
        /// </summary>
        /// <param name="reader">
        /// The <see cref="IDataReader"/> to extract data from.
        /// Implementations should not close this: it will be closed
        /// by the AdoTemplate.</param>
        /// <returns>
        /// Null is returned since <see cref="IRowCallback"/> or
        /// <see cref="RowCallbackDelegate"/> manages its own state.
        /// </returns>
        public virtual object ExtractData(IDataReader reader)
        {
            reader = ExtendDataReader(reader);
            if (_rowCallback != null)
            {
                while (reader.Read())
                {
                    _rowCallback.ProcessRow(reader);
                }
            }
            else
            {
                while (reader.Read())
                {
                    _rowCallbackDelegate(reader);
                }
            }

            return(null);
        }