public override void SetUp() { base.SetUp(); _dbCommandBuilderFactoryStrictMock = MockRepository.GenerateStrictMock <IDbCommandBuilderFactory>(); _objectReaderFactoryStrictMock = MockRepository.GenerateStrictMock <IObjectReaderFactory>(); _dataStoragePropertyDefinitionFactoryStrictMock = MockRepository.GenerateStrictMock <IDataStoragePropertyDefinitionFactory> (); _factory = new QueryCommandFactory( _objectReaderFactoryStrictMock, _dbCommandBuilderFactoryStrictMock, _dataStoragePropertyDefinitionFactoryStrictMock); _dataContainerReader1Stub = MockRepository.GenerateStub <IObjectReader <DataContainer> >(); _resultRowReaderStub = MockRepository.GenerateStub <IObjectReader <IQueryResultRow> >(); _queryParameter1 = new QueryParameter("first", DomainObjectIDs.Order1); _queryParameter2 = new QueryParameter("second", DomainObjectIDs.Order3.Value); _queryParameter3 = new QueryParameter("third", DomainObjectIDs.Official1); var collection = new QueryParameterCollection { _queryParameter1, _queryParameter2, _queryParameter3 }; _queryStub = MockRepository.GenerateStub <IQuery>(); _queryStub.Stub(stub => stub.Statement).Return("statement"); _queryStub.Stub(stub => stub.Parameters).Return(new QueryParameterCollection(collection, true)); _property1 = ObjectIDStoragePropertyDefinitionObjectMother.Create("Test"); _property2 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty(); _property3 = SerializedObjectIDStoragePropertyDefinitionObjectMother.Create("Test"); }
public override void SetUp() { base.SetUp(); _rdbmsPersistenceModelProvider = new RdbmsPersistenceModelProvider(); _dbCommandBuilderFactoryStrictMock = MockRepository.GenerateStrictMock <IDbCommandBuilderFactory>(); _objectReaderFactoryStrictMock = MockRepository.GenerateStrictMock <IObjectReaderFactory>(); _dbCommandBuilderStub = MockRepository.GenerateStub <IDbCommandBuilder> (); _dataContainerReaderStub = MockRepository.GenerateStub <IObjectReader <DataContainer> > (); _objectIDReaderStub = MockRepository.GenerateStub <IObjectReader <ObjectID> > (); _fakeStorageProviderCommandFactory = MockRepository.GenerateStub <IStorageProviderCommandFactory <IRdbmsProviderCommandExecutionContext> >(); _factory = new RelationLookupCommandFactory( _fakeStorageProviderCommandFactory, _dbCommandBuilderFactoryStrictMock, _rdbmsPersistenceModelProvider, _objectReaderFactoryStrictMock); _tableDefinition = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "Table1")); _unionViewDefinition = UnionViewDefinitionObjectMother.Create( TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "ViewName"), _tableDefinition); _foreignKeyValue = CreateObjectID(_tableDefinition); _foreignKeyStoragePropertyDefinitionStrictMock = MockRepository.GenerateStrictMock <IRdbmsStoragePropertyDefinition>(); _fakeComparedColumns = new[] { new ColumnValue(ColumnDefinitionObjectMother.IDColumn, _foreignKeyValue.Value) }; }
public RdbmsProviderCommandFactory( RdbmsProviderDefinition storageProviderDefinition, IDbCommandBuilderFactory dbCommandBuilderFactory, IRdbmsPersistenceModelProvider rdbmsPersistenceModelProvider, IObjectReaderFactory objectReaderFactory, ITableDefinitionFinder tableDefinitionFinder, IDataStoragePropertyDefinitionFactory dataStoragePropertyDefinitionFactory) { ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition); ArgumentUtility.CheckNotNull("dbCommandBuilderFactory", dbCommandBuilderFactory); ArgumentUtility.CheckNotNull("rdbmsPersistenceModelProvider", rdbmsPersistenceModelProvider); ArgumentUtility.CheckNotNull("objectReaderFactory", objectReaderFactory); ArgumentUtility.CheckNotNull("tableDefinitionFinder", tableDefinitionFinder); ArgumentUtility.CheckNotNull("dataStoragePropertyDefinitionFactory", dataStoragePropertyDefinitionFactory); _storageProviderDefinition = storageProviderDefinition; _dbCommandBuilderFactory = dbCommandBuilderFactory; _rdbmsPersistenceModelProvider = rdbmsPersistenceModelProvider; _objectReaderFactory = objectReaderFactory; _tableDefinitionFinder = tableDefinitionFinder; _dataStoragePropertyDefinitionFactory = dataStoragePropertyDefinitionFactory; // ReSharper disable DoNotCallOverridableMethodsInConstructor _lookupCommandFactory = CreateLookupCommandFactory(); _relationLookupCommandFactory = CreateRelationLookupCommandFactory(); _saveCommandFactory = CreateSaveCommandFactory(); _queryCommandFactory = CreateQueryCommandFactory(); // ReSharper restore DoNotCallOverridableMethodsInConstructor }
public override void SetUp() { base.SetUp(); _tableDefinitionFinder = new TableDefinitionFinder(new RdbmsPersistenceModelProvider()); _dbCommandBuilderFactoryStrictMock = MockRepository.GenerateStrictMock <IDbCommandBuilderFactory>(); _objectReaderFactoryStrictMock = MockRepository.GenerateStrictMock <IObjectReaderFactory>(); _dbCommandBuilder1Stub = MockRepository.GenerateStub <IDbCommandBuilder>(); _dbCommandBuilder2Stub = MockRepository.GenerateStub <IDbCommandBuilder>(); _timestampReader1Stub = MockRepository.GenerateStub <IObjectReader <Tuple <ObjectID, object> > > (); _timestampReader2Stub = MockRepository.GenerateStub <IObjectReader <Tuple <ObjectID, object> > > (); _dataContainerReader1Stub = MockRepository.GenerateStub <IObjectReader <DataContainer> > (); _dataContainerReader2Stub = MockRepository.GenerateStub <IObjectReader <DataContainer> > (); _factory = new LookupCommandFactory( TestDomainStorageProviderDefinition, _dbCommandBuilderFactoryStrictMock, _objectReaderFactoryStrictMock, _tableDefinitionFinder); _tableDefinition1 = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition); _tableDefinition2 = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition); _objectID1 = CreateObjectID(_tableDefinition1); _objectID2 = CreateObjectID(_tableDefinition1); _objectID3 = CreateObjectID(_tableDefinition2); }
public SaveCommandFactory( IDbCommandBuilderFactory dbCommandBuilderFactory, IRdbmsPersistenceModelProvider rdbmsPersistenceModelProvider, ITableDefinitionFinder tableDefinitionFinder) { ArgumentUtility.CheckNotNull("dbCommandBuilderFactory", dbCommandBuilderFactory); ArgumentUtility.CheckNotNull("rdbmsPersistenceModelProvider", rdbmsPersistenceModelProvider); ArgumentUtility.CheckNotNull("tableDefinitionFinder", tableDefinitionFinder); _dbCommandBuilderFactory = dbCommandBuilderFactory; _rdbmsPersistenceModelProvider = rdbmsPersistenceModelProvider; _tableDefinitionFinder = tableDefinitionFinder; }
public QueryCommandFactory( IObjectReaderFactory objectReaderFactory, IDbCommandBuilderFactory dbCommandBuilderFactory, IDataStoragePropertyDefinitionFactory dataStoragePropertyDefinitionFactory) { ArgumentUtility.CheckNotNull("objectReaderFactory", objectReaderFactory); ArgumentUtility.CheckNotNull("dbCommandBuilderFactory", dbCommandBuilderFactory); ArgumentUtility.CheckNotNull("dataStoragePropertyDefinitionFactory", dataStoragePropertyDefinitionFactory); _objectReaderFactory = objectReaderFactory; _dbCommandBuilderFactory = dbCommandBuilderFactory; _dataStoragePropertyDefinitionFactory = dataStoragePropertyDefinitionFactory; }
public TestableSqlStorageObjectFactory(IRdbmsPersistenceModelProvider rdbmsPersistenceModelProvider, IStorageTypeInformationProvider storageTypeInformationProvider, IDbCommandBuilderFactory dbCommandBuilderFactory, IStorageNameProvider storageNameProvider, IInfrastructureStoragePropertyDefinitionProvider infrastructureStoragePropertyDefinitionProvider, IDataStoragePropertyDefinitionFactory dataStoragePropertyDefinitionFactory, IValueStoragePropertyDefinitionFactory valueStoragePropertyDefinitionFactory, IRelationStoragePropertyDefinitionFactory relationStoragePropertyDefinitionFactory, ISqlQueryGenerator sqlQueryGenerator, IForeignKeyConstraintDefinitionFactory foreignKeyConstraintDefinitionFactoryFactory, IStoragePropertyDefinitionResolver storagePropertyDefinitionResolver) { _infrastructureStoragePropertyDefinitionProvider = infrastructureStoragePropertyDefinitionProvider; _storageNameProvider = storageNameProvider; _dbCommandBuilderFactory = dbCommandBuilderFactory; _storageTypeInformationProvider = storageTypeInformationProvider; _rdbmsPersistenceModelProvider = rdbmsPersistenceModelProvider; _dataStoragePropertyDefinitionFactory = dataStoragePropertyDefinitionFactory; _valueStoragePropertyDefinitionFactory = valueStoragePropertyDefinitionFactory; _relationStoragePropertyDefinitionFactory = relationStoragePropertyDefinitionFactory; _sqlQueryGenerator = sqlQueryGenerator; _foreignKeyConstraintDefinitionFactory = foreignKeyConstraintDefinitionFactoryFactory; _storagePropertyDefinitionResolver = storagePropertyDefinitionResolver; }
public override void SetUp() { base.SetUp(); _dbCommandBuilderFactoryStrictMock = MockRepository.GenerateStrictMock <IDbCommandBuilderFactory>(); _rdbmsPersistenceModelProvider = new RdbmsPersistenceModelProvider(); _tableDefinitionFinderStrictMock = MockRepository.GenerateStrictMock <ITableDefinitionFinder>(); _factory = new SaveCommandFactory( _dbCommandBuilderFactoryStrictMock, _rdbmsPersistenceModelProvider, _tableDefinitionFinderStrictMock); _tableDefinition1 = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "Table1")); }
public LookupCommandFactory( StorageProviderDefinition storageProviderDefinition, IDbCommandBuilderFactory dbCommandBuilderFactory, IObjectReaderFactory objectReaderFactory, ITableDefinitionFinder tableDefinitionFinder) { ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition); ArgumentUtility.CheckNotNull("dbCommandBuilderFactory", dbCommandBuilderFactory); ArgumentUtility.CheckNotNull("objectReaderFactory", objectReaderFactory); ArgumentUtility.CheckNotNull("tableDefinitionFinder", tableDefinitionFinder); _storageProviderDefinition = storageProviderDefinition; _dbCommandBuilderFactory = dbCommandBuilderFactory; _objectReaderFactory = objectReaderFactory; _tableDefinitionFinder = tableDefinitionFinder; }
public RelationLookupCommandFactory( IStorageProviderCommandFactory <IRdbmsProviderCommandExecutionContext> storageProviderCommandFactory, IDbCommandBuilderFactory dbCommandBuilderFactory, IRdbmsPersistenceModelProvider rdbmsPersistenceModelProvider, IObjectReaderFactory objectReaderFactory) { ArgumentUtility.CheckNotNull("storageProviderCommandFactory", storageProviderCommandFactory); ArgumentUtility.CheckNotNull("dbCommandBuilderFactory", dbCommandBuilderFactory); ArgumentUtility.CheckNotNull("rdbmsPersistenceModelProvider", rdbmsPersistenceModelProvider); ArgumentUtility.CheckNotNull("objectReaderFactory", objectReaderFactory); _storageProviderCommandFactory = storageProviderCommandFactory; _dbCommandBuilderFactory = dbCommandBuilderFactory; _rdbmsPersistenceModelProvider = rdbmsPersistenceModelProvider; _objectReaderFactory = objectReaderFactory; }
public void SetUp() { _rdbmsProviderDefinition = new RdbmsProviderDefinition("TestDomain", new SqlStorageObjectFactory(), "ConnectionString"); _sqlProviderFactory = new SqlStorageObjectFactory(); _persistenceExtensionStub = MockRepository.GenerateStub <IPersistenceExtension>(); _storageProviderDefinitionFinder = new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage); _tableBuilderStub = MockRepository.GenerateStub <TableScriptBuilder> ( MockRepository.GenerateStub <ITableScriptElementFactory>(), new SqlCommentScriptElementFactory()); _viewBuilderStub = MockRepository.GenerateStub <ViewScriptBuilder> ( MockRepository.GenerateStub <IViewScriptElementFactory <TableDefinition> >(), MockRepository.GenerateStub <IViewScriptElementFactory <UnionViewDefinition> >(), MockRepository.GenerateStub <IViewScriptElementFactory <FilterViewDefinition> >(), MockRepository.GenerateStub <IViewScriptElementFactory <EmptyViewDefinition> >(), new SqlCommentScriptElementFactory()); _constraintBuilderStub = MockRepository.GenerateStub <ForeignKeyConstraintScriptBuilder> ( MockRepository.GenerateStub <IForeignKeyConstraintScriptElementFactory>(), new SqlCommentScriptElementFactory()); _indexScriptElementFactoryStub = MockRepository.GenerateStub <SqlIndexScriptElementFactory> ( MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlIndexDefinition> >(), MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlPrimaryXmlIndexDefinition> >(), MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlSecondaryXmlIndexDefinition> >()); _indexBuilderStub = MockRepository.GenerateStub <IndexScriptBuilder> (_indexScriptElementFactoryStub, new SqlCommentScriptElementFactory()); _synonymBuilderStub = MockRepository.GenerateStub <SynonymScriptBuilder> ( MockRepository.GenerateStub <ISynonymScriptElementFactory <TableDefinition> >(), MockRepository.GenerateStub <ISynonymScriptElementFactory <UnionViewDefinition> >(), MockRepository.GenerateStub <ISynonymScriptElementFactory <FilterViewDefinition> >(), MockRepository.GenerateStub <ISynonymScriptElementFactory <EmptyViewDefinition> >(), new SqlCommentScriptElementFactory()); _rdbmsPersistenceModelProviderStub = MockRepository.GenerateStub <IRdbmsPersistenceModelProvider>(); _storageTypeInformationProviderStub = MockRepository.GenerateStub <IStorageTypeInformationProvider>(); _dbCommandBuilderFactoryStub = MockRepository.GenerateStub <IDbCommandBuilderFactory>(); MockRepository.GeneratePartialMock <SqlSynonymScriptElementFactory>(); _storageNameProviderStub = MockRepository.GenerateStub <IStorageNameProvider>(); _infrastructureStoragePropertyDefinitionProviderStub = MockRepository.GenerateStub <IInfrastructureStoragePropertyDefinitionProvider>(); _dataStoragePropertyDefinitionFactoryStub = MockRepository.GenerateStub <IDataStoragePropertyDefinitionFactory>(); _valueStoragePropertyDefinitonFactoryStub = MockRepository.GenerateStub <IValueStoragePropertyDefinitionFactory>(); _relationStoragePropertyDefiniitonFactoryStub = MockRepository.GenerateStub <IRelationStoragePropertyDefinitionFactory>(); _methodCallTransformerProviderStub = MockRepository.GenerateStub <IMethodCallTransformerProvider>(); _resultOpertatorHandlerRegistryStub = MockRepository.GeneratePartialMock <ResultOperatorHandlerRegistry>(); _sqlQueryGeneratorStub = MockRepository.GenerateStub <ISqlQueryGenerator>(); _foreignKeyConstraintDefinitionFactoryStub = MockRepository.GenerateStub <IForeignKeyConstraintDefinitionFactory>(); _storagePropertyDefinitionResolverStub = MockRepository.GenerateStub <IStoragePropertyDefinitionResolver>(); }