コード例 #1
0
        public void When_updating_from_two_tables_Then_builds_properly()
        {
            var statement = new UpdateStatement(new[] { "Name" }, tableToUpdate: "u")
                            .From("Users u")
                            .InnerJoin("Teams t", "u.TeamID = t.ID")
                            .Where("t.IsOld = TRUE");

            var sql = statement.ToSql();

            sql.Should().BeEquivalentToIgnoringNewLines(@"UPDATE u
SET
    Name = @Name
FROM
    Users u
    INNER JOIN Teams t ON u.TeamID = t.ID
WHERE
    t.IsOld = TRUE");
        }
コード例 #2
0
        public void When_updating_from_two_tables_Then_builds_properly()
        {
            var statement = new UpdateStatement(new[] { "Name" }, tableToUpdate: "u")
                            .From("Users u")
                            .InnerJoin("Teams t", "u.TeamID = t.ID")
                            .Where("t.IsOld = TRUE");

            var sql = statement.ToSql();

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