private void SetShaper(Shaper<RecordState> shaper, CoordinatorFactory<RecordState> coordinatorFactory, int depth) { _shaper = shaper; _coordinatorFactory = coordinatorFactory; _dataRecord = new BridgeDataRecord(shaper, depth); // To determine whether there are any rows for this coordinator at this place in // the root enumerator, we pretty much just look at it's current record (we'll read // one if there isn't one waiting) and if it matches our coordinator, we've got rows. _hasRows = false; if (!_shaper.DataWaiting) { _shaper.DataWaiting = _shaper.RootEnumerator.MoveNext(); } if (_shaper.DataWaiting) { var currentRecord = _shaper.RootEnumerator.Current; if (null != currentRecord) { _hasRows = (currentRecord.CoordinatorFactory == _coordinatorFactory); } } // Once we've created the root enumerator, we can get the default record state _defaultRecordState = coordinatorFactory.GetDefaultRecordState(_shaper); Debug.Assert(null != _defaultRecordState, "no default?"); }
public void GetValues_throws_for_null_argument() { var dbDataReaderMock = new Mock<DbDataReader>(); var coordinatorFactory = Objects.MockHelper.CreateCoordinatorFactory<RecordState>(shaper => null); var shaperMock = new Mock<Shaper<RecordState>>(dbDataReaderMock.Object, /*context*/ null, /*workspace*/ null, MergeOption.AppendOnly, /*stateCount*/ 1, coordinatorFactory, /*checkPermissions*/ null, /*readerOwned*/ false) { CallBase = true }; var bridgeDataRecord = new BridgeDataRecord(shaperMock.Object, 0); Assert.Equal("values", Assert.Throws<ArgumentNullException>( () => bridgeDataRecord.GetValues(null)).ParamName); }