public void ToStringTestForeignKeyComposite() { var dd = new ForeignKeyComposite(); var topOrdersPerCompany = dd.GetTable("TopOrdersPerCompany"); var fks = topOrdersPerCompany.Properties.OfType <ForeignKey>().ToList(); var fk1ToString = fks[0].ToString(); var fk2ToString = fks[1].ToString(); Assert.AreEqual("TopOrdersPerCompany.Top1A -> Order.OrderHeaderId, TopOrdersPerCompany.Top1B -> Order.LineNumber", fk1ToString); Assert.AreEqual("TopOrdersPerCompany.Top2A -> Order.OrderHeaderId, TopOrdersPerCompany.Top2B -> Order.LineNumber", fk2ToString); }
protected static DatabaseDefinitions Fk_Change_Composite_NameChange_Dds(SqlEngineVersion version) { var ddOriginal = new ForeignKeyComposite(); ddOriginal.GetTable("Order").AddInt32("LineNumber2"); ddOriginal.GetTable("Order").AddUniqueConstraintWithName("UQ_Order_OrderHeaderId_LineNumber_LineNumber2", "OrderHeaderId", "LineNumber", "LineNumber2"); ddOriginal.GetTable("TopOrdersPerCompany").AddInt32("Top2C"); ddOriginal.SetVersions(version.GetTypeMapper()); var ddFkChanged = new ForeignKeyComposite2(); ddFkChanged.SetVersions(version.GetTypeMapper()); return(new DatabaseDefinitions(ddOriginal, ddFkChanged, "ForeignKeyComposite", "ForeignKeyComposite2_Fk_Change_Composite_NameChange")); }
protected static DatabaseDefinitions Fk_Change_Composite_NoNameChange_Dds(SqlEngineVersion version) { var ddOriginal = new ForeignKeyComposite(); ddOriginal.GetTable("Order").AddInt32("LineNumber2"); ddOriginal.GetTable("Order").AddUniqueConstraintWithName("UQ_Order_OrderHeaderId_LineNumber_LineNumber2", "OrderHeaderId", "LineNumber", "LineNumber2"); ddOriginal.GetTable("TopOrdersPerCompany").AddInt32("Top2C"); ddOriginal.SetVersions(version.GetTypeMapper()); var fkOriginal = ddOriginal .GetTable("TopOrdersPerCompany").Properties .OfType <ForeignKey>() .First(fk => fk.ForeignKeyColumns.Any(fkcm => fkcm.ForeignKeyColumn.Name == "Top2A")); fkOriginal.Name = "FK_TopOrdersPerCompany_2"; var ddFkChanged = new ForeignKeyComposite2(); ddFkChanged.SetVersions(version.GetTypeMapper()); return(new DatabaseDefinitions(ddOriginal, ddFkChanged, "ForeignKeyComposite", "ForeignKeyComposite2_Fk_Change_Composite_NoNameChange")); }
public void CheckCompositeFks1() { var tables = new ForeignKeyComposite().GetTables(); CheckCompositeFks(tables); }