public static void SimpleAddForeignKey()
{
var constraint = new SqlTableConstraint(ConstraintType.ForeignKey, new[] { "ref_id" }) {
ReferenceTable = "test_table1",
ReferenceColumns = new[] { "id" }
};
var statement = new AlterTableStatement(ObjectName.Parse("test"), new AddConstraintAction(constraint));
var sql = statement.ToString();
var expected = new StringBuilder();
expected.Append("ALTER TABLE test ADD CONSTRAINT FOREIGN KEY(ref_id) ");
expected.Append("REFERENCES test_table1(id) ");
expected.Append("ON DELETE NO ACTION ");
expected.Append("ON UPDATE NO ACTION");
Assert.AreEqual(expected.ToString(), sql);
}