public void RelationshipsFromTableWithNoColumnsIsEmpty() { CdmEntityRelationshipGenerator generator = BuildCdmEntityRelationshipGenerator(); var table = new Table("Customer"); var relationships = generator.GenerateRelationships(table); Assert.Empty(relationships); }
public void RelationshipsIsNotNull() { CdmEntityRelationshipGenerator generator = BuildCdmEntityRelationshipGenerator(); var table = new Table("Customer"); var relationships = generator.GenerateRelationships(table); Assert.NotNull(relationships); }
public void RelationshipsFromTableWithSingleColumnContainsSingleRelationship() { CdmEntityRelationshipGenerator generator = BuildCdmEntityRelationshipGenerator(); var fk = new Table("Customer").WithColumn("ID", SqlDbType.Int).GetColumn(); var table = new Table("CustomerAddresses").WithColumn("C_ID", SqlDbType.Int, foreignKey: fk); var relationships = generator.GenerateRelationships(table); Assert.Single(relationships); }
public void RelationshipMatchesTableColumnForeignTableConstraint() { CdmEntityRelationshipGenerator generator = BuildCdmEntityRelationshipGenerator(); var fk = new Table("Customer").WithColumn("ID", SqlDbType.Int).GetColumn(); var table = new Table("CustomerAddresses").WithColumn("C_ID", SqlDbType.Int, foreignKey: fk); CdmE2ERelationship relationship = generator.GenerateRelationships(table).First(); Assert.Matches(".*.cdm.json/CustomerAddresses", relationship.FromEntity); Assert.Matches(".*.cdm.json/Customer", relationship.ToEntity); }