public void When_deleting_from_two_tables_Then_builds_properly()
        {
            var statement = new DeleteStatement(tableToDelete: "u")
                            .From("Users u")
                            .InnerJoin("Teams t", "u.TeamID = t.ID")
                            .Where("t.IsOld = TRUE");

            var sql = statement.ToSql();

            sql.Should().BeEquivalentToIgnoringNewLines(@"DELETE u
FROM
    Users u
    INNER JOIN Teams t ON u.TeamID = t.ID
WHERE
    t.IsOld = TRUE");
        }
示例#2
0
        public void When_deleting_from_two_tables_Then_builds_properly()
        {
            var statement = new DeleteStatement(tableToDelete: "u")
                            .From("Users u")
                            .InnerJoin("Teams t", "u.TeamID = t.ID")
                            .Where("t.IsOld = TRUE");

            var sql = statement.ToSql();

            Assert.That(
                sql,
                SqlCompareConstraint.EqualTo(@"DELETE u
FROM
    Users u
    INNER JOIN Teams t ON u.TeamID = t.ID
WHERE
    t.IsOld = TRUE"));
        }