Exemple #1
0
        public override void SetUp()
        {
            base.SetUp();

            _storageTypeInformationProviderStub = MockRepository.GenerateStub <IStorageTypeInformationProvider> ();

            _idStorageTypeInformation = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
            _storageTypeInformationProviderStub
            .Stub(stub => stub.GetStorageTypeForID(false))
            .Return(_idStorageTypeInformation);

            _classIDStorageTypeInformation = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
            _storageTypeInformationProviderStub
            .Stub(stub => stub.GetStorageTypeForClassID(false))
            .Return(_classIDStorageTypeInformation);

            _timestampStorageTypeInformation = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
            _storageTypeInformationProviderStub
            .Stub(stub => stub.GetStorageTypeForTimestamp(false))
            .Return(_timestampStorageTypeInformation);

            _storageNameProviderStub = MockRepository.GenerateStub <IStorageNameProvider>();
            _storageNameProviderStub.Stub(stub => stub.GetIDColumnName()).Return("ID");
            _storageNameProviderStub.Stub(stub => stub.GetClassIDColumnName()).Return("ClassID");
            _storageNameProviderStub.Stub(stub => stub.GetTimestampColumnName()).Return("Timestamp");

            _infrastructureStoragePropertyDefinitionProvider =
                new InfrastructureStoragePropertyDefinitionProvider(_storageTypeInformationProviderStub, _storageNameProviderStub);
        }
Exemple #2
0
        public void UnifyWithEquivalentProperties_ThrowsForDifferentPrimaryKeyFlag()
        {
            var storageTypeInformation = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
            var property1 = new SimpleStoragePropertyDefinition(typeof(int), ColumnDefinitionObjectMother.CreateColumn("Col", storageTypeInformation, true));
            var property2 = new SimpleStoragePropertyDefinition(typeof(int), ColumnDefinitionObjectMother.CreateColumn("Col", storageTypeInformation, false));

            Assert.That(
                () => property1.UnifyWithEquivalentProperties(new[] { property2 }),
                Throws.ArgumentException.With.Message.EqualTo(
                    "Only equivalent properties can be combined, but this property has primary key flag 'True', and the given property has "
                    + "primary key flag 'False'.\r\nParameter name: equivalentProperties"));
        }
Exemple #3
0
        public override void SetUp()
        {
            base.SetUp();

            _storageNameProviderMock                  = MockRepository.GenerateStrictMock <IStorageNameProvider>();
            _storageProviderDefinitionFinderStub      = MockRepository.GenerateStub <IStorageProviderDefinitionFinder>();
            _storageTypeInformationProviderStrictMock = MockRepository.GenerateStrictMock <IStorageTypeInformationProvider> ();

            _factory = new RelationStoragePropertyDefinitionFactory(TestDomainStorageProviderDefinition,
                                                                    false, _storageNameProviderMock, _storageTypeInformationProviderStrictMock, _storageProviderDefinitionFinderStub);

            _fakeStorageTypeInformation1 = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
            _fakeStorageTypeInformation2 = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
        }
        public void SetUp()
        {
            _storageTypeInformationProviderMock = MockRepository.GenerateStrictMock <IStorageTypeInformationProvider> ();
            _storageNameProviderStub            = MockRepository.GenerateStub <IStorageNameProvider>();

            _factory = new ValueStoragePropertyDefinitionFactory(_storageTypeInformationProviderMock, _storageNameProviderStub);

            _someClassDefinition = ClassDefinitionObjectMother.CreateClassDefinition();

            _someClassDefinitionWithoutBaseClass  = ClassDefinitionObjectMother.CreateClassDefinition();
            _someClassDefinitionWithBaseClass     = ClassDefinitionObjectMother.CreateClassDefinition(id: "some", baseClass: _someClassDefinitionWithoutBaseClass);
            _someClassDefinitionWithBaseBaseClass = ClassDefinitionObjectMother.CreateClassDefinition(id: "some", baseClass: _someClassDefinitionWithBaseClass);

            _fakeStorageTypeInformation1 = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
            _fakeStorageTypeInformation2 = StorageTypeInformationObjectMother.CreateStorageTypeInformation();
        }
        public void SetUp()
        {
            var storageTypeInformation = StorageTypeInformationObjectMother.CreateStorageTypeInformation();

            _columnDefinition1 = ColumnDefinitionObjectMother.CreateColumn(storageTypeInformation: storageTypeInformation);
            _columnDefinition2 = ColumnDefinitionObjectMother.CreateColumn(storageTypeInformation: storageTypeInformation);
            _columnDefinition3 = ColumnDefinitionObjectMother.CreateColumn(storageTypeInformation: storageTypeInformation);

            _property1Stub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>();
            _property2Stub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>();
            _property3Stub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>();

            _yearProperty  = new CompoundStoragePropertyDefinition.NestedPropertyInfo(_property1Stub, o => ((DateTime)o).Year);
            _monthProperty = new CompoundStoragePropertyDefinition.NestedPropertyInfo(_property2Stub, o => ((DateTime)o).Month);
            _dayProperty   = new CompoundStoragePropertyDefinition.NestedPropertyInfo(_property3Stub, o => ((DateTime)o).Day);

            _compoundStoragePropertyDefinition = new CompoundStoragePropertyDefinition(
                typeof(DateTime),
                new[] { _yearProperty, _monthProperty, _dayProperty },
                objects => new DateTime((int)objects[0], (int)objects[1], (int)objects[2]));
        }
Exemple #6
0
 private static SimpleStoragePropertyDefinition CreateStorageProperyDefinitionWithNameAndNullability(string columnName, bool isStorageTypeNullable)
 {
     return(SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty(
                columnName,
                storageTypeInformation: StorageTypeInformationObjectMother.CreateStorageTypeInformation(isStorageTypeNullable: isStorageTypeNullable)));
 }
        public void SetUp()
        {
            _storageTypeInformation = StorageTypeInformationObjectMother.CreateStorageTypeInformation();

            _columnDefinition = new ColumnDefinition("Name", _storageTypeInformation, true);
        }
Exemple #8
0
 private static StorageTypeInformation CreateDefinedStorageTypeInformation(bool isStorageTypeNullable = false)
 {
     return(StorageTypeInformationObjectMother.CreateStorageTypeInformation(isStorageTypeNullable: isStorageTypeNullable));
 }