public void TestDatabaseCircular3FK() { var dd = new TestDatabaseCircular3FK(); var a = dd.GetTable("A"); var b = dd.GetTable("B"); var c = dd.GetTable("C"); var aCFK = a.Properties.OfType <CircularFK>().First(); var bCFK = b.Properties.OfType <CircularFK>().First(); var cCFK = c.Properties.OfType <CircularFK>().First(); Assert.AreEqual("A", aCFK.SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("B", bCFK.SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("C", cCFK.SqlTable.SchemaAndTableName.TableName); Assert.AreEqual(3, aCFK.ForeignKeyChain.Count); Assert.AreEqual(3, bCFK.ForeignKeyChain.Count); Assert.AreEqual(3, cCFK.ForeignKeyChain.Count); Assert.AreEqual("A", aCFK.ForeignKeyChain.First().SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("C", aCFK.ForeignKeyChain.Last().SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("B", bCFK.ForeignKeyChain.First().SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("A", bCFK.ForeignKeyChain.Last().SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("C", cCFK.ForeignKeyChain.First().SqlTable.SchemaAndTableName.TableName); Assert.AreEqual("B", cCFK.ForeignKeyChain.Last().SqlTable.SchemaAndTableName.TableName); }
public void TestDatabaseCircular3FK() { var tables = new TestDatabaseCircular3FK().GetTables(); Assert.AreEqual(3, tables.Count); CheckFK(tables, "A", "BId"); CheckFK(tables, "B", "CId"); CheckFK(tables, "C", "AId"); }