Exemplo n.º 1
0
        public void SetUp()
        {
            _storageProviderID         = "DefaultStorageProvider";
            _storageProviderDefinition = new UnitTestStorageProviderStubDefinition(_storageProviderID);
            _infrastructureStoragePropertyDefinitionProviderMock = MockRepository.GenerateStrictMock <IInfrastructureStoragePropertyDefinitionProvider>();
            _storagePropertyDefinitionResolverMock = MockRepository.GenerateStrictMock <IStoragePropertyDefinitionResolver>();
            _storageNameProviderMock = MockRepository.GenerateStrictMock <IStorageNameProvider>();
            _foreignKeyConstraintDefinitionFactoryMock = MockRepository.GenerateStrictMock <IForeignKeyConstraintDefinitionFactory>();
            _factory = new RdbmsStorageEntityDefinitionFactory(
                _infrastructureStoragePropertyDefinitionProviderMock,
                _foreignKeyConstraintDefinitionFactoryMock,
                _storagePropertyDefinitionResolverMock,
                _storageNameProviderMock,
                _storageProviderDefinition);
            _testModel = new RdbmsPersistenceModelLoaderTestHelper();

            _fakeObjectIDStorageProperty  = ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty;
            _fakeStorageProperty1         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test1");
            _fakeTimestampStorageProperty = SimpleStoragePropertyDefinitionObjectMother.TimestampProperty;

            _fakeForeignKeyConstraint = new ForeignKeyConstraintDefinition(
                "FakeForeignKeyConstraint",
                new EntityNameDefinition(null, "Test"),
                new[] { StoragePropertyDefinitionTestHelper.GetIDColumnDefinition(_fakeObjectIDStorageProperty) },
                new[] { _fakeStorageProperty1.ColumnDefinition });
        }
Exemplo n.º 2
0
        public override void SetUp()
        {
            base.SetUp();

            _storageProviderDefinitionFinder = new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage);
            _storageProviderDefinition       = (RdbmsProviderDefinition)_storageProviderDefinitionFinder.GetStorageProviderDefinition(
                storageGroupTypeOrNull: null, errorMessageContext: "SetUp");

            var factory = _storageProviderDefinition.Factory;

            _rdbmsPersistenceModelLoader =
                (RdbmsPersistenceModelLoader)factory.CreatePersistenceModelLoader(_storageProviderDefinition, _storageProviderDefinitionFinder);

            _testModel = new RdbmsPersistenceModelLoaderTestHelper();

            var infrastructureStoragePropertyDefinitionProvider =
                ((RdbmsStorageEntityDefinitionFactory)_rdbmsPersistenceModelLoader.EntityDefinitionFactory).InfrastructureStoragePropertyDefinitionProvider;

            _infrastructureObjectIDStoragePropertyDefinition  = infrastructureStoragePropertyDefinitionProvider.GetObjectIDStoragePropertyDefinition();
            _infrastructureIDStoragePropertyDefinition        = (SimpleStoragePropertyDefinition)_infrastructureObjectIDStoragePropertyDefinition.ValueProperty;
            _infrastructureClassIDStoragePropertyDefinition   = (SimpleStoragePropertyDefinition)_infrastructureObjectIDStoragePropertyDefinition.ClassIDProperty;
            _infrastructureTimestampStoragePropertyDefinition =
                (SimpleStoragePropertyDefinition)infrastructureStoragePropertyDefinitionProvider.GetTimestampStoragePropertyDefinition();

            _fakeBaseBaseStoragePropertyDefinition       = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("BaseBaseProperty");
            _fakeBaseStoragePropertyDefinition           = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("BaseProperty");
            _fakeTableStoragePropertyDefinition1         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("TableProperty1");
            _fakeTableStoragePropertyDefinition2         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("TableProperty2");
            _fakeDerivedStoragePropertyDefinition1       = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("DerivedProperty1");
            _fakeDerivedStoragePropertyDefinition2       = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("DerivedProperty2");
            _fakeDerivedDerivedStoragePropertyDefinition = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("DerivedDerivedProperty");

            _testModel.BaseBasePropertyDefinition.SetStorageProperty(_fakeBaseBaseStoragePropertyDefinition);
            _testModel.BasePropertyDefinition.SetStorageProperty(_fakeBaseStoragePropertyDefinition);
            _testModel.TablePropertyDefinition1.SetStorageProperty(_fakeTableStoragePropertyDefinition1);
            _testModel.TablePropertyDefinition2.SetStorageProperty(_fakeTableStoragePropertyDefinition2);
            _testModel.DerivedPropertyDefinition1.SetStorageProperty(_fakeDerivedStoragePropertyDefinition1);
            _testModel.DerivedPropertyDefinition2.SetStorageProperty(_fakeDerivedStoragePropertyDefinition2);
            _testModel.DerivedDerivedPropertyDefinition.SetStorageProperty(_fakeDerivedDerivedStoragePropertyDefinition);
        }
Exemplo n.º 3
0
        public void SetUp()
        {
            _persistenceModelProviderStub = MockRepository.GenerateStub <IRdbmsPersistenceModelProvider>();
            _resolver  = new StoragePropertyDefinitionResolver(_persistenceModelProviderStub);
            _testModel = new RdbmsPersistenceModelLoaderTestHelper();

            _fakeStorageProperyDefinition1 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test1");
            _fakeStorageProperyDefinition2 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test2");
            _fakeStorageProperyDefinition3 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test3");
            _fakeStorageProperyDefinition4 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test4");
            _fakeStorageProperyDefinition5 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test5");
            _fakeStorageProperyDefinition6 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test6");
            _fakeStorageProperyDefinition7 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test7");

            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.BaseBasePropertyDefinition))
            .Return(_fakeStorageProperyDefinition1);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.BaseBasePropertyDefinition))
            .Return(_fakeStorageProperyDefinition1);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.BasePropertyDefinition))
            .Return(_fakeStorageProperyDefinition2);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.TablePropertyDefinition1))
            .Return(_fakeStorageProperyDefinition3);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.TablePropertyDefinition2))
            .Return(_fakeStorageProperyDefinition4);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.DerivedPropertyDefinition1))
            .Return(_fakeStorageProperyDefinition5);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.DerivedPropertyDefinition2))
            .Return(_fakeStorageProperyDefinition6);
            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(_testModel.DerivedDerivedPropertyDefinition))
            .Return(_fakeStorageProperyDefinition7);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            _storageProviderID         = "DefaultStorageProvider";
            _storageProviderDefinition = new UnitTestStorageProviderStubDefinition(_storageProviderID);
            _testModel = new RdbmsPersistenceModelLoaderTestHelper();

            _entityDefinitionFactoryMock = MockRepository.GenerateStrictMock <IRdbmsStorageEntityDefinitionFactory>();
            _dataStoragePropertyDefinitionFactoryMock = MockRepository.GenerateStrictMock <IDataStoragePropertyDefinitionFactory>();
            _storageNameProviderStub = MockRepository.GenerateStub <IStorageNameProvider>();
            _storageNameProviderStub.Stub(stub => stub.GetTableName(_testModel.TableClassDefinition1)).Return(
                new EntityNameDefinition(null, _testModel.TableClassDefinition1.ID));
            _storageNameProviderStub.Stub(stub => stub.GetTableName(_testModel.TableClassDefinition2)).Return(
                new EntityNameDefinition(null, _testModel.TableClassDefinition2.ID));

            _rdbmsPersistenceModelLoader = new RdbmsPersistenceModelLoader(
                _entityDefinitionFactoryMock,
                _dataStoragePropertyDefinitionFactoryMock,
                _storageNameProviderStub,
                new RdbmsPersistenceModelProvider());

            _fakeEntityDefinitionBaseBase              = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionBase                  = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionTable1                = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionTable2                = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionDerived1              = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionDerived2              = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionDerivedDerived        = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();
            _fakeEntityDefinitionDerivedDerivedDerived = MockRepository.GenerateStub <IRdbmsStorageEntityDefinition>();

            _fakeColumnDefinition1 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test1");
            _fakeColumnDefinition2 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test2");
            _fakeColumnDefinition3 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test3");
            _fakeColumnDefinition4 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test4");
            _fakeColumnDefinition5 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test5");
            _fakeColumnDefinition6 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test6");
            _fakeColumnDefinition7 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test7");
        }