public void ForeignKeyRelationshipTreeDatabaseRootTableHasBackwardReference()
        {
            ForeignKeyRelationshipTreeDatabase database = new ForeignKeyRelationshipTreeDatabase();
            DatabaseSchemaAndData databaseSchemaAndData = new DatabaseSchemaAndData(database);

            Assert.AreEqual(1, databaseSchemaAndData.GetTableForeignKeyRelationshipReferencers(database.RootTable).Count);
        }
        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));
        }
        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);
        }