コード例 #1
0
        public void ForeignKeyRelationshipTreeDatabaseRootTableHasBackwardReference()
        {
            ForeignKeyRelationshipTreeDatabase database = new ForeignKeyRelationshipTreeDatabase();
            DatabaseSchemaAndData databaseSchemaAndData = new DatabaseSchemaAndData(database);

            Assert.AreEqual(1, databaseSchemaAndData.GetTableForeignKeyRelationshipReferencers(database.RootTable).Count);
        }
コード例 #2
0
        public void SelfReferencingTableForeignKeyRelationshipContainsCorrectSelfReferences()
        {
            SelfReferencingTableDatabase database = new SelfReferencingTableDatabase();
            DatabaseSchemaAndData databaseSchemaAndData = new DatabaseSchemaAndData(database);

            Assert.AreEqual(1, databaseSchemaAndData.GenerateTableForeignKeyRelationshipTree(database.Table).Count);
        }
コード例 #3
0
        public void TableForeignKeyRelationshipTreeIncludesBackwardsReferences()
        {
            ForeignKeyRelationshipTreeDatabase database = new ForeignKeyRelationshipTreeDatabase();
            DatabaseSchemaAndData databaseSchemaAndData = new DatabaseSchemaAndData(database);

            Assert.Contains(
                new TableRelationship(-1, database.BackwardReferenceTable, database.RootTable),
                databaseSchemaAndData.GenerateTableForeignKeyRelationshipTree(database.RootTable));
        }
コード例 #4
0
        public void ForeignKeyRelationshipTreeDatabaseRootTableBackwardReferenceIsBackwardReferenceTable()
        {
            ForeignKeyRelationshipTreeDatabase database = new ForeignKeyRelationshipTreeDatabase();
            DatabaseSchemaAndData databaseSchemaAndData = new DatabaseSchemaAndData(database);

            Assert.AreEqual(
                database.BackwardReferenceTable.Name,
                databaseSchemaAndData.GetTableForeignKeyRelationshipReferencers(database.RootTable)[0].BaseTable.Name);

            Assert.AreEqual(
                database.BackwardReferenceTable,
                databaseSchemaAndData.GetTableForeignKeyRelationshipReferencers(database.RootTable)[0].BaseTable);
        }