public void TestDatabaseFks() { var tables = new TestDatabaseFks().GetTables(); Assert.AreEqual(3, tables.Count); CheckFK(tables, "Child", "ParentId"); }
public void TestDatabaseFks() { var dd = new TestDatabaseFks(); var parent = dd.GetTable("Parent"); var child = dd.GetTable("Child"); var childChild = dd.GetTable("ChildChild"); var parentCFKs = parent.Properties.OfType <CircularFK>().Count(); var childCFKs = child.Properties.OfType <CircularFK>().Count(); var childChildCFKs = childChild.Properties.OfType <CircularFK>().Count(); Assert.AreEqual(0, parentCFKs); Assert.AreEqual(0, childCFKs); Assert.AreEqual(0, childChildCFKs); }
public void ToStringTestTestDatabaseFks() { var dd = new TestDatabaseFks(); var child = dd.GetTable("Child"); var fkToString = child.Properties.OfType <ForeignKey>().First().ToString(); Assert.AreEqual("Child.ParentId -> Parent.Id", fkToString); var childChild = dd.GetTable("ChildChild"); fkToString = childChild.Properties.OfType <ForeignKey>().First().ToString(); Assert.AreEqual("ChildChild.ChildId -> Child.Id", fkToString); }