public void GetColumnsForComparison()
        {
            _valuePropertyStub.Stub(stub => stub.GetColumnsForComparison()).Return(new[] { _valueColumnDefinition });
            _classIDPropertyStub.Stub(stub => stub.GetColumnsForComparison()).Return(new[] { _classIDColumnDefinition });

            Assert.That(_objectIDStoragePropertyDefinition.GetColumnsForComparison(), Is.EqualTo(new[] { _valueColumnDefinition }));
        }
예제 #2
0
        public void Read_DataReaderReadTrue_ValueIDNull()
        {
            _dataReaderStrictMock.Expect(mock => mock.Read()).Return(true);

            _idPropertyStrictMock
            .Stub(stub => stub.CombineValue(Arg <IColumnValueProvider> .Is.Anything))
            .Return(null);
            ReplayAll();

            var dataContainer = _dataContainerReader.Read(_dataReaderStrictMock);

            VerifyAll();
            Assert.That(dataContainer, Is.Null);
        }
        public void GetColumns()
        {
            _property1Stub.Stub(stub => stub.GetColumns()).Return(new[] { _columnDefinition1 });
            _property2Stub.Stub(stub => stub.GetColumns()).Return(new[] { _columnDefinition2 });
            _property3Stub.Stub(stub => stub.GetColumns()).Return(new[] { _columnDefinition3 });

            var result = _compoundStoragePropertyDefinition.GetColumns();

            Assert.That(result, Is.EqualTo(new[] { _columnDefinition1, _columnDefinition2, _columnDefinition3 }));
        }
예제 #4
0
        public void Read_DataReaderReadTrue_ThrowsException()
        {
            _dataReaderStrictMock.Expect(mock => mock.Read()).Return(true);

            _idPropertyStrictMock
            .Stub(stub => stub.CombineValue(Arg <IColumnValueProvider> .Is.Anything))
            .Return(DomainObjectIDs.OrderTicket1);
            _timestampPropertyStrictMock
            .Stub(stub => stub.CombineValue(Arg <IColumnValueProvider> .Is.Anything))
            .Return(_fakeTimestamp);
            ReplayAll();

            var propertyDefinition = GetPropertyDefinition(typeof(OrderTicket), "FileName");

            _persistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(propertyDefinition))
            .Throw(new InvalidOperationException("TestException"));

            _dataContainerReader.Read(_dataReaderStrictMock);
        }
 public void GetColumnsForComparison()
 {
     _serializedIDPropertyStub.Stub(stub => stub.GetColumnsForComparison()).Return(new[] { _columnDefinition });
     Assert.That(_serializedObjectIDStoragePropertyDefinition.GetColumnsForComparison(), Is.EqualTo(new[] { _columnDefinition }));
 }
예제 #6
0
        public void ResolveProperty_NoPrimaryKeyColumn()
        {
            var propertyDefinition = PropertyDefinitionObjectMother.CreateForFakePropertyInfo();
            var entityExpression   = CreateEntityDefinition(typeof(Order), "o");

            _rdbmsPersistenceModelProviderStub
            .Stub(stub => stub.GetStoragePropertyDefinition(propertyDefinition))
            .Return(_rdbmsStoragePropertyDefinitionStub);

            var columnDefinition = ColumnDefinitionObjectMother.CreateColumn("OrderNumber");

            _rdbmsStoragePropertyDefinitionStub.Stub(stub => stub.PropertyType).Return(typeof(string));
            _rdbmsStoragePropertyDefinitionStub.Stub(stub => stub.GetColumns()).Return(new[] { columnDefinition });

            var result = (SqlColumnDefinitionExpression)_storageSpecificExpressionResolver.ResolveProperty(entityExpression, propertyDefinition);

            Assert.That(result.ColumnName, Is.EqualTo("OrderNumber"));
            Assert.That(result.OwningTableAlias, Is.EqualTo("o"));
            Assert.That(result.Type, Is.SameAs(typeof(string)));
            Assert.That(result.IsPrimaryKey, Is.False);
        }