public IStorageProviderCommand <IEnumerable <ObjectLookupResult <DataContainer> >, IRdbmsProviderCommandExecutionContext> CreateForSortedMultiIDLookup ( IEnumerable <ObjectID> objectIDs) { ArgumentUtility.CheckNotNull("objectIDs", objectIDs); return(_lookupCommandFactory.CreateForSortedMultiIDLookup(objectIDs)); }
public void CreateForSortedMultiIDLookup_SingleIDLookup() { var expectedSelectedColumns = _tableDefinition1.GetAllColumns(); var expectedComparedColumns = new[] { new ColumnValue(StoragePropertyDefinitionTestHelper.GetIDColumnDefinition(_tableDefinition1.ObjectIDProperty), _objectID1.Value) }; _dbCommandBuilderFactoryStrictMock .Stub( stub => stub.CreateForSelect( Arg.Is(_tableDefinition1), Arg <IEnumerable <ColumnDefinition> > .List.Equal(expectedSelectedColumns), Arg <IEnumerable <ColumnValue> > .List.Equal(expectedComparedColumns), Arg <IEnumerable <OrderedColumn> > .List.Equal(new OrderedColumn[0]))) .Return(_dbCommandBuilder1Stub); _objectReaderFactoryStrictMock .Expect( mock => mock.CreateDataContainerReader( Arg.Is((IRdbmsStorageEntityDefinition)_tableDefinition1), Arg <IEnumerable <ColumnDefinition> > .List.Equal(expectedSelectedColumns))) .Return(_dataContainerReader1Stub); _objectReaderFactoryStrictMock.Replay(); var result = _factory.CreateForSortedMultiIDLookup(new[] { _objectID1 }); _objectReaderFactoryStrictMock.VerifyAllExpectations(); Assert.That(result, Is.TypeOf(typeof(MultiDataContainerAssociateWithIDsCommand))); Assert.That(((MultiDataContainerAssociateWithIDsCommand)result).Command, Is.TypeOf(typeof(MultiObjectLoadCommand <DataContainer>))); var dbCommandBuilderTuples = ((MultiObjectLoadCommand <DataContainer>)((MultiDataContainerAssociateWithIDsCommand)result).Command).DbCommandBuildersAndReaders; Assert.That(dbCommandBuilderTuples.Length, Is.EqualTo(1)); Assert.That(dbCommandBuilderTuples[0].Item1, Is.SameAs(_dbCommandBuilder1Stub)); Assert.That(dbCommandBuilderTuples[0].Item2, Is.SameAs(_dataContainerReader1Stub)); }