Exemplo n.º 1
0
        public void RelationshipsFromTableWithNoColumnsIsEmpty()
        {
            CdmEntityRelationshipGenerator generator = BuildCdmEntityRelationshipGenerator();
            var table = new Table("Customer");

            var relationships = generator.GenerateRelationships(table);

            Assert.Empty(relationships);
        }
Exemplo n.º 2
0
        public void RelationshipsIsNotNull()
        {
            CdmEntityRelationshipGenerator generator = BuildCdmEntityRelationshipGenerator();
            var table = new Table("Customer");

            var relationships = generator.GenerateRelationships(table);

            Assert.NotNull(relationships);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }