public void GetSchemaCollections() { ExecuteSQL("CREATE TABLE parent (id int, name_parent VARCHAR(20), PRIMARY KEY(id))"); ExecuteSQL(@"CREATE TABLE child (id int, name_child VARCHAR(20), parent_id INT, PRIMARY KEY(id), INDEX par_id (parent_id), FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE)"); ExecuteSQL("INSERT INTO parent VALUES(1, 'parent_1')"); ExecuteSQL("INSERT INTO child VALUES(1, 'child_1', 1)"); SchemaProvider schema = new SchemaProvider(Connection); string[] restrictions = new string[5]; restrictions[2] = "parent"; restrictions[1] = Connection.Database; MySqlSchemaCollection schemaCollection = schema.GetSchema("columns", restrictions); Assert.True(schemaCollection.Columns.Count == 20); Assert.True(schemaCollection.Rows.Count == 2); Assert.AreEqual("parent", schemaCollection.Rows[0]["TABLE_NAME"]); Assert.AreEqual("id", schemaCollection.Rows[0]["COLUMN_NAME"]); schemaCollection = schema.GetForeignKeys(restrictions); Assert.True(schemaCollection.AsDataTable().Columns.Contains("REFERENCED_TABLE_NAME")); schemaCollection = schema.GetForeignKeyColumns(restrictions); Assert.True(schemaCollection.AsDataTable().Columns.Contains("REFERENCED_COLUMN_NAME")); schemaCollection = schema.GetUDF(restrictions); Assert.True(schemaCollection.AsDataTable().Columns.Contains("RETURN_TYPE")); schemaCollection = schema.GetUsers(restrictions); Assert.True(schemaCollection.AsDataTable().Columns.Contains("USERNAME")); }