public void ResolveJoin_LeftSideHoldsNoForeignKey() { var propertyDefinition = CreatePropertyDefinitionAndAssociateWithClass(_classDefinition, "Customer", "Customer"); var leftEndPointDefinition = new AnonymousRelationEndPointDefinition(_classDefinition); var rightEndPointDefinition = new RelationEndPointDefinition(propertyDefinition, false); var entityExpression = CreateEntityDefinition(typeof(Customer), "c"); _rdbmsPersistenceModelProviderStub .Stub(stub => stub.GetEntityDefinition(rightEndPointDefinition.ClassDefinition)) .Return(rightEndPointDefinition.ClassDefinition.StorageEntityDefinition as IRdbmsStorageEntityDefinition); _rdbmsPersistenceModelProviderStub .Stub(stub => stub.GetStoragePropertyDefinition(rightEndPointDefinition.PropertyDefinition)) .Return(_rdbmsStoragePropertyDefinitionStub); _rdbmsStoragePropertyDefinitionStub .Stub(stub => stub.GetColumnsForComparison()) .Return(new[] { ColumnDefinitionObjectMother.CreateGuidColumn("Customer") }); _rdbmsStoragePropertyDefinitionStub.Stub(stub => stub.PropertyType).Return(typeof(ObjectID)); var result = _storageSpecificExpressionResolver.ResolveJoin(entityExpression, leftEndPointDefinition, rightEndPointDefinition, "o"); SqlExpressionTreeComparer.CheckAreEqualTrees( Expression.Equal( entityExpression.GetIdentityExpression(), // c.ID new SqlColumnDefinitionExpression(typeof(Guid), "o", "Customer", false)), result.JoinCondition); }
public void CreateForeignKeyConstraint() { var referencedColumnDefinition = ColumnDefinitionObjectMother.CreateColumn("c2"); var referencedValuePropertyStub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition> (); referencedValuePropertyStub.Stub(stub => stub.GetColumnsForComparison()).Return(new[] { referencedColumnDefinition }); var referencedObjectIDProperty = new ObjectIDStoragePropertyDefinition( referencedValuePropertyStub, SimpleStoragePropertyDefinitionObjectMother.ClassIDProperty); _valuePropertyStub.Stub(stub => stub.GetColumnsForComparison()).Return(new[] { _valueColumnDefinition }); var result = _objectIDStoragePropertyDefinition.CreateForeignKeyConstraint( cols => { Assert.That(cols, Is.EqualTo(new[] { _valueColumnDefinition })); return("fkname"); }, new EntityNameDefinition("entityschema", "entityname"), referencedObjectIDProperty); Assert.That(result.ConstraintName, Is.EqualTo("fkname")); Assert.That(result.ReferencedTableName, Is.EqualTo(new EntityNameDefinition("entityschema", "entityname"))); Assert.That(result.ReferencingColumns, Is.EqualTo(new[] { _valueColumnDefinition })); Assert.That(result.ReferencedColumns, Is.EqualTo(new[] { referencedColumnDefinition })); }
public void Combine_Two() { var column1 = ColumnDefinitionObjectMother.CreateColumn("1"); var column2 = ColumnDefinitionObjectMother.CreateColumn("2"); var column3 = ColumnDefinitionObjectMother.CreateColumn("3"); var column4 = ColumnDefinitionObjectMother.CreateColumn("4"); var one = new ColumnValueTable( new[] { column1, column2 }, new[] { new ColumnValueTable.Row(new[] { "a", "b" }), new ColumnValueTable.Row(new[] { "c", "d" }) }); var two = new ColumnValueTable( new[] { column3, column4 }, new[] { new ColumnValueTable.Row(new[] { "e", "f" }), new ColumnValueTable.Row(new[] { "g", "h" }) }); var result = ColumnValueTable.Combine(one, two); var expected = new ColumnValueTable( new[] { column1, column2, column3, column4 }, new[] { new ColumnValueTable.Row(new[] { "a", "b", "e", "f" }), new ColumnValueTable.Row(new[] { "c", "d", "g", "h" }) }); ColumnValueTableTestHelper.CheckTable(expected, result); }
public void GetOrdinal_DifferentColumnOfSameName() { var columnDefinition = ColumnDefinitionObjectMother.CreateColumn(_columnDefinition.Name); var result = _dictionaryBasedColumnOrdinalProvider.GetOrdinal(columnDefinition, _dataReaderStub); Assert.That(result, Is.EqualTo(5)); }
public void Union_DuplicatedColumns() { var column4 = ColumnDefinitionObjectMother.CreateColumn("Column4"); var result = (SelectedColumnsSpecification)_specification.Union(new[] { column4, column4 }); Assert.That(result.SelectedColumns, Is.EqualTo(new[] { _column1, _column2, _column3, column4 })); }
public void GetForeignKeyConstraintName_One() { var columnDefinition = ColumnDefinitionObjectMother.CreateColumn("FakeColumn"); var result = _provider.GetForeignKeyConstraintName(_classDefinition, new[] { columnDefinition }); Assert.That(result, Is.EqualTo("FK_Company_FakeColumn")); }
public void SetUp() { _columns = new[] { new SqlIndexedColumnDefinition(ColumnDefinitionObjectMother.CreateColumn("TestColumn1")) }; _includedColumns = new[] { ColumnDefinitionObjectMother.CreateColumn("TestColumn2") }; _sqlIndexDefinition = new SqlIndexDefinition( "IndexName", _columns, _includedColumns, true, true, true, true, true, 5, true, true, true, true, true, 2); }
public void SetUp() { _dataReaderStub = MockRepository.GenerateStub <IDataReader>(); _columnOrdinalProviderStub = MockRepository.GenerateStub <IColumnOrdinalProvider>(); _storageTypeInformationStrictMock = MockRepository.GenerateStrictMock <IStorageTypeInformation>(); _columnDefinition = ColumnDefinitionObjectMother.CreateColumn(storageTypeInformation: _storageTypeInformationStrictMock); _columnValueReader = new ColumnValueReader(_dataReaderStub, _columnOrdinalProviderStub); }
public void SetUp() { _storageTypeInformationStub = MockRepository.GenerateStub <IStorageTypeInformation>(); _innerColumnDefinition = ColumnDefinitionObjectMother.CreateColumn(storageTypeInformation: _storageTypeInformationStub); _storagePropertyDefinition = new SimpleStoragePropertyDefinition(typeof(string), _innerColumnDefinition); _dbCommandStub = MockRepository.GenerateStub <IDbCommand>(); _dbDataParameterStub = MockRepository.GenerateStub <IDbDataParameter> (); _dbCommandStub.Stub(stub => stub.CreateParameter()).Return(_dbDataParameterStub); }
public void SetUp() { _storageProviderDefinition = new UnitTestStorageProviderStubDefinition("DefaultStorageProvider"); _referencingColumn = ColumnDefinitionObjectMother.CreateColumn("COL1"); _referencedColumn = ColumnDefinitionObjectMother.CreateColumn("COL2"); _referencedTableName = "TableName"; _constraint = new ForeignKeyConstraintDefinition( "Test", new EntityNameDefinition(null, _referencedTableName), new[] { _referencingColumn }, new[] { _referencedColumn }); }
public void SetUp() { _columnDefinition = ColumnDefinitionObjectMother.CreateColumn("Testcolumn 1"); var columnDefinition2 = ColumnDefinitionObjectMother.CreateColumn("Testcolumn 2"); _dataReaderStub = MockRepository.GenerateStub <IDataReader> (); _ordinals = new Dictionary <string, int> { { _columnDefinition.Name, 5 }, { columnDefinition2.Name, 3 } }; _dictionaryBasedColumnOrdinalProvider = new DictionaryBasedColumnOrdinalProvider(_ordinals); }
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")); }
public void UnifyWithEquivalentProperties_ThrowsForDifferentPropertyType() { var columnDefinition = ColumnDefinitionObjectMother.CreateColumn(); var property1 = new SimpleStoragePropertyDefinition(typeof(int), columnDefinition); var property2 = new SimpleStoragePropertyDefinition(typeof(string), columnDefinition); Assert.That( () => property1.UnifyWithEquivalentProperties(new[] { property2 }), Throws.ArgumentException.With.Message.EqualTo( "Only equivalent properties can be combined, but this property has property type 'System.Int32', and the given property has " + "property type 'System.String'.\r\nParameter name: equivalentProperties")); }
public override void SetUp() { base.SetUp(); _column1 = ColumnDefinitionObjectMother.CreateColumn("Column1"); _column2 = ColumnDefinitionObjectMother.CreateColumn("Column2"); _column3 = ColumnDefinitionObjectMother.CreateColumn("Column3"); _specification = new SelectedColumnsSpecification(new[] { _column1, _column2, _column3 }); _sqlDialectStub = MockRepository.GenerateStub <ISqlDialect>(); _sqlDialectStub.Stub(stub => stub.DelimitIdentifier("Column1")).Return("[delimited Column1]"); _sqlDialectStub.Stub(stub => stub.DelimitIdentifier("Column2")).Return("[delimited Column2]"); _sqlDialectStub.Stub(stub => stub.DelimitIdentifier("Column3")).Return("[delimited Column3]"); }
public override void SetUp() { base.SetUp(); _factory = new SqlPrimaryXmlIndexDefinitionScriptElementFactory(); _xmlColumn = ColumnDefinitionObjectMother.CreateColumn("XmlColumn"); _customSchemaNameDefinition = new EntityNameDefinition("SchemaName", "TableName1"); _indexDefinitionWithCustomSchema = new SqlPrimaryXmlIndexDefinition("Index1", _xmlColumn); _defaultSchemaNameDefinition = new EntityNameDefinition(null, "TableName2"); _indexDefinitionWithDefaultSchema = new SqlPrimaryXmlIndexDefinition("Index2", _xmlColumn); }
public override void SetUp() { base.SetUp(); _serializedIDPropertyStub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>(); _serializedObjectIDStoragePropertyDefinition = new SerializedObjectIDStoragePropertyDefinition(_serializedIDPropertyStub); _columnValueProviderStub = MockRepository.GenerateStub <IColumnValueProvider> (); _dbCommandStub = MockRepository.GenerateStub <IDbCommand>(); _dbDataParameterStub = MockRepository.GenerateStub <IDbDataParameter>(); _dbCommandStub.Stub(stub => stub.CreateParameter()).Return(_dbDataParameterStub).Repeat.Once(); _columnDefinition = ColumnDefinitionObjectMother.CreateColumn(); }
public void CalculateFullColumnList_MatchesByNameRatherThanIdentity() { var availableColumns = new[] { ColumnDefinitionObjectMother.CreateColumn(_property3.ColumnDefinition.Name) }; var result = _unionViewDefinition.CalculateFullColumnList(availableColumns).ToArray(); Assert.That(result.Length, Is.EqualTo(6)); Assert.That(result[0], Is.Null); Assert.That(result[1], Is.Null); Assert.That(result[2], Is.Null); Assert.That(result[3], Is.Null); Assert.That(result[4], Is.Null); Assert.That(result[5], Is.SameAs(availableColumns[0])); }
public void CalculateAdjustedColumnList() { var fullColumnList = new[] { _property3.ColumnDefinition, _property1.ColumnDefinition, ColumnDefinitionObjectMother.CreateColumn() }; var adjustedColumnList = _tableDefinition.CalculateAdjustedColumnList(fullColumnList); Assert.That(adjustedColumnList, Is.EqualTo(new[] { _property3.ColumnDefinition, _property1.ColumnDefinition, null })); }
public override void SetUp() { base.SetUp(); _factory = new SqlForeignKeyConstraintScriptElementFactory(); _column1 = ColumnDefinitionObjectMother.CreateColumn("Column1"); _column2 = ColumnDefinitionObjectMother.CreateColumn("Column2"); _table1 = new EntityNameDefinition(null, "TableName1"); _table2 = new EntityNameDefinition("SchemaName", "TableName2"); _constraint1 = new ForeignKeyConstraintDefinition("FK1", _table1, new[] { _column1 }, new[] { _column2 }); _constraint2 = new ForeignKeyConstraintDefinition("FK2", _table2, new[] { _column1, _column2 }, new[] { _column2, _column1 }); }
public override void SetUp() { base.SetUp(); _factory = new SqlIndexDefinitionScriptElementFactory(); _column1 = new SqlIndexedColumnDefinition(ColumnDefinitionObjectMother.CreateColumn("IndexColumn1"), IndexOrder.Desc); _column2 = new SqlIndexedColumnDefinition(ColumnDefinitionObjectMother.CreateColumn("IndexColumn2"), IndexOrder.Asc); _includedColumn1 = ColumnDefinitionObjectMother.CreateColumn("IncludedColumn1"); _includedColumn2 = ColumnDefinitionObjectMother.CreateColumn("IncludedColumn2"); _customSchemaNameDefinition = new EntityNameDefinition("SchemaName", "TableName1"); _indexDefinitionWithCustomSchema = new SqlIndexDefinition("Index1", new[] { _column1 }); _defaultSchemaNameDefinition = new EntityNameDefinition(null, "TableName2"); _indexDefinitionWithDefaultSchema = new SqlIndexDefinition("Index2", new[] { _column2 }); }
public override void SetUp() { base.SetUp(); _classDefinition = DomainObjectIDs.Order1.ClassDefinition; _valueColumnDefinition = ColumnDefinitionObjectMother.CreateColumn(); _valuePropertyStub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>(); _objectIDWithoutClassIDStoragePropertyDefinition = new ObjectIDWithoutClassIDStoragePropertyDefinition( _valuePropertyStub, _classDefinition); _columnValueProviderStub = MockRepository.GenerateStub <IColumnValueProvider> (); _dbCommandStub = MockRepository.GenerateStub <IDbCommand>(); _dbDataParameterStub = MockRepository.GenerateStub <IDbDataParameter>(); _dbCommandStub.Stub(stub => stub.CreateParameter()).Return(_dbDataParameterStub).Repeat.Once(); }
public override void SetUp() { base.SetUp(); _sqlDialectStub = MockRepository.GenerateStub <ISqlDialect>(); _factory = new SqlDbCommandBuilderFactory(_sqlDialectStub); _tableDefinition = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "Table")); _column1 = ColumnDefinitionObjectMother.CreateColumn("Column1"); _column2 = ColumnDefinitionObjectMother.CreateColumn("Column2"); _columnValue1 = new ColumnValue(_column1, new object()); _columnValue2 = new ColumnValue(_column2, new object()); _orderColumn1 = new OrderedColumn(_column1, SortOrder.Ascending); _orderColumn2 = new OrderedColumn(_column2, SortOrder.Descending); }
public void ResolveJoin_LeftSideHoldsForeignKey() { // Order.Customer var propertyDefinition = CreatePropertyDefinitionAndAssociateWithClass(_classDefinition, "Customer", "Customer"); var columnDefinition = ColumnDefinitionObjectMother.CreateGuidColumn("Customer"); _rdbmsStoragePropertyDefinitionStub.Stub(stub => stub.GetColumnsForComparison()).Return(new[] { columnDefinition }); _rdbmsStoragePropertyDefinitionStub.Stub(stub => stub.PropertyType).Return(typeof(ObjectID)); var leftEndPointDefinition = new RelationEndPointDefinition(propertyDefinition, false); _rdbmsPersistenceModelProviderStub .Stub(stub => stub.GetStoragePropertyDefinition(leftEndPointDefinition.PropertyDefinition)) .Return(_rdbmsStoragePropertyDefinitionStub); // Customer.Order var customerClassDefinition = ClassDefinitionObjectMother.CreateClassDefinition(classType: typeof(Customer)); var customerTableDefinition = TableDefinitionObjectMother.Create( TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "CustomerTable"), new EntityNameDefinition(null, "CustomerView")); _rdbmsPersistenceModelProviderStub .Stub(stub => stub.GetEntityDefinition(customerClassDefinition)) .Return(customerTableDefinition); var rightEndPointDefinition = new AnonymousRelationEndPointDefinition(customerClassDefinition); var originatingEntity = CreateEntityDefinition(typeof(Order), "o"); var result = _storageSpecificExpressionResolver.ResolveJoin(originatingEntity, leftEndPointDefinition, rightEndPointDefinition, "c"); Assert.That(result, Is.Not.Null); Assert.That(result.ItemType, Is.EqualTo(typeof(Customer))); Assert.That(result.ForeignTableInfo, Is.TypeOf(typeof(ResolvedSimpleTableInfo))); Assert.That(((ResolvedSimpleTableInfo)result.ForeignTableInfo).TableName, Is.EqualTo("CustomerView")); Assert.That(((ResolvedSimpleTableInfo)result.ForeignTableInfo).TableAlias, Is.EqualTo("c")); var expected = Expression.Equal( new SqlColumnDefinitionExpression(typeof(Guid), "o", "Customer", false), new SqlColumnDefinitionExpression(typeof(Guid), "c", "ID", true)); SqlExpressionTreeComparer.CheckAreEqualTrees(expected, result.JoinCondition); }
public void Combine_Many() { var column1 = ColumnDefinitionObjectMother.CreateColumn("1"); var column2 = ColumnDefinitionObjectMother.CreateColumn("2"); var column3 = ColumnDefinitionObjectMother.CreateColumn("3"); var column4 = ColumnDefinitionObjectMother.CreateColumn("4"); var column5 = ColumnDefinitionObjectMother.CreateColumn("5"); var column6 = ColumnDefinitionObjectMother.CreateColumn("6"); var one = new ColumnValueTable( new[] { column1, column2 }, new[] { new ColumnValueTable.Row(new[] { "a", "b" }), new ColumnValueTable.Row(new[] { "c", "d" }) }); var two = new ColumnValueTable( new[] { column3, column4 }, new[] { new ColumnValueTable.Row(new[] { "e", "f" }), new ColumnValueTable.Row(new[] { "g", "h" }) }); var three = new ColumnValueTable( new[] { column5, column6 }, new[] { new ColumnValueTable.Row(new[] { "i", "j" }), new ColumnValueTable.Row(new[] { "k", "l" }) }); var result = ColumnValueTable.Combine(new[] { one, two, three }); var expected = new ColumnValueTable( new[] { column1, column2, column3, column4, column5, column6 }, new[] { new ColumnValueTable.Row(new[] { "a", "b", "e", "f", "i", "j" }), new ColumnValueTable.Row(new[] { "c", "d", "g", "h", "k", "l" }) }); ColumnValueTableTestHelper.CheckTable(expected, result); }
public void SetUp () { _column1 = ColumnDefinitionObjectMother.CreateColumn ("Column1"); _column2 = ColumnDefinitionObjectMother.CreateColumn ("Column2"); _column3 = ColumnDefinitionObjectMother.CreateColumn ("Column3"); _specification = new OrderedColumnsSpecification ( new[] { new OrderedColumn(_column1, SortOrder.Ascending), new OrderedColumn(_column2, SortOrder.Descending), new OrderedColumn(_column3, SortOrder.Ascending) }); _sqlDialectStub = MockRepository.GenerateStub<ISqlDialect>(); _sqlDialectStub.Stub (stub => stub.DelimitIdentifier ("Column1")).Return ("[delimited Column1]"); _sqlDialectStub.Stub (stub => stub.DelimitIdentifier ("Column2")).Return ("[delimited Column2]"); _sqlDialectStub.Stub (stub => stub.DelimitIdentifier ("Column3")).Return ("[delimited Column3]"); _specificationWithEmptyColumns = new OrderedColumnsSpecification (new OrderedColumn[0]); }
public void UnifyWithEquivalentProperties_CombinesPropertiesAndColumns() { var isPartOfPrimaryKey = BooleanObjectMother.GetRandomBoolean(); var property1 = new SimpleStoragePropertyDefinition( typeof(int), ColumnDefinitionObjectMother.CreateColumn("Col", CreateDefinedStorageTypeInformation(false), isPartOfPrimaryKey)); var property2 = new SimpleStoragePropertyDefinition( typeof(int), ColumnDefinitionObjectMother.CreateColumn("Col", CreateDefinedStorageTypeInformation(false), isPartOfPrimaryKey)); var property3 = new SimpleStoragePropertyDefinition( typeof(int), ColumnDefinitionObjectMother.CreateColumn("Col", CreateDefinedStorageTypeInformation(true), isPartOfPrimaryKey)); var result = property1.UnifyWithEquivalentProperties(new[] { property2, property3 }); Assert.That(result, Is.TypeOf <SimpleStoragePropertyDefinition> ().With.Property("PropertyType").SameAs(typeof(int))); Assert.That(((SimpleStoragePropertyDefinition)result).ColumnDefinition.Name, Is.EqualTo("Col")); Assert.That(((SimpleStoragePropertyDefinition)result).ColumnDefinition.StorageTypeInfo.IsStorageTypeNullable, Is.True); Assert.That(((SimpleStoragePropertyDefinition)result).ColumnDefinition.IsPartOfPrimaryKey, Is.EqualTo(isPartOfPrimaryKey)); }
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])); }
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); }
public void CalculateFullColumnList() { var availableColumns = new[] { ColumnDefinitionObjectMother.IDColumn, ColumnDefinitionObjectMother.ClassIDColumn, ColumnDefinitionObjectMother.TimestampColumn, _property3.ColumnDefinition, ColumnDefinitionObjectMother.CreateColumn("Test"), _property1.ColumnDefinition }; var result = _unionViewDefinition.CalculateFullColumnList(availableColumns).ToArray(); Assert.That(result.Length, Is.EqualTo(6)); Assert.That(result[0], Is.SameAs(ColumnDefinitionObjectMother.IDColumn)); Assert.That(result[1], Is.SameAs(ColumnDefinitionObjectMother.ClassIDColumn)); Assert.That(result[2], Is.SameAs(ColumnDefinitionObjectMother.TimestampColumn)); Assert.That(result[3], Is.SameAs(_property1.ColumnDefinition)); Assert.That(result[4], Is.Null); Assert.That(result[5], Is.SameAs(_property3.ColumnDefinition)); }
public void SetUp() { _columnDefinition = ColumnDefinitionObjectMother.CreateColumn("Column", StorageTypeInformationObjectMother.CreateVarchar100StorageTypeInformation()); _objectValue1 = "<Test1"; _objectValue2 = 689; _objectValue3 = true; _specification = new SqlXmlSetComparedColumnSpecification(_columnDefinition, new[] { _objectValue1, _objectValue2, _objectValue3 }); _statement = new StringBuilder(); _parametersCollectionMock = MockRepository.GenerateStrictMock <IDataParameterCollection> (); _commandStub = MockRepository.GenerateStub <IDbCommand> (); _commandStub.Stub(stub => stub.Parameters).Return(_parametersCollectionMock); _parameterStub = MockRepository.GenerateStub <IDbDataParameter>(); _commandStub.Stub(stub => stub.CreateParameter()).Return(_parameterStub); _sqlDialectStub = MockRepository.GenerateStub <ISqlDialect> (); _sqlDialectStub.Stub(stub => stub.StatementDelimiter).Return("delimiter"); }