Beispiel #1
0
        public void CreateStatementOneForeignKeyTwoPrimaryKeyTest()
        {
            var foreignKeyStatement = new ForeignKeyStatement
            {
                CascadeDelete = false,
                ForeignKey    = new List <string> {
                    "dummyForeignKey1"
                },
                ForeignPrimaryKey = new List <string> {
                    "dummForeignPrimaryKey1", "dummForeignPrimaryKey2"
                },
                ForeignTable = "dummyForeignTable"
            };

            string output = foreignKeyStatement.CreateStatement();

            Assert.AreEqual(output, "FOREIGN KEY (dummyForeignKey1) REFERENCES dummyForeignTable(dummForeignPrimaryKey1, dummForeignPrimaryKey2)");
        }
Beispiel #2
0
        public void CreateStatementOneForeignKeyCascadeDeleteTest()
        {
            var foreignKeyStatement = new ForeignKeyStatement
            {
                CascadeDelete = true,
                ForeignKey    = new List <string> {
                    "dummyForeignKey1"
                },
                ForeignPrimaryKey = new List <string> {
                    "dummForeignPrimaryKey1"
                },
                ForeignTable = "dummyForeignTable"
            };

            string output = foreignKeyStatement.CreateStatement();

            Assert.AreEqual(output, "FOREIGN KEY (dummyForeignKey1) REFERENCES dummyForeignTable(dummForeignPrimaryKey1) ON DELETE CASCADE");
        }