Skip to content

Commit e709930

Browse files
Copilotjzabroski
andcommitted
Add integration test cases for backward compatibility with RawSql values
Co-authored-by: jzabroski <[email protected]>
1 parent 34b564a commit e709930

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

test/FluentMigrator.Tests/Integration/MigrationRunnerTests.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,11 +1602,12 @@ public void CanUseRawSqlInUpdateAndDelete(Type processorType, Func<IntegrationTe
16021602
DataSet upDs = processor.ReadTableData("TestSchema", "Foo");
16031603

16041604
var rows = upDs.Tables[0].Rows;
1605-
rows.Count.ShouldBe(3);
1605+
rows.Count.ShouldBe(4);
16061606

16071607
rows[0]["Baz"].ShouldBe(1);
16081608
rows[1]["Baz"].ShouldBe(2);
16091609
rows[2]["Baz"].ShouldBe(3);
1610+
rows[3]["Baz"].ShouldBe(4);
16101611

16111612
runner.Up(new RawSqlUpdateMigration());
16121613
upDs = processor.ReadTableData("TestSchema", "Foo");
@@ -1615,6 +1616,7 @@ public void CanUseRawSqlInUpdateAndDelete(Type processorType, Func<IntegrationTe
16151616
rows[0]["Baz"].ShouldBe(101);
16161617
rows[1]["Baz"].ShouldBe(102);
16171618
rows[2]["Baz"].ShouldBe(103);
1619+
rows[3]["Baz"].ShouldBe(104);
16181620

16191621
runner.Up(new RawSqlDeleteMigration());
16201622
upDs = processor.ReadTableData("TestSchema", "Foo");
@@ -2129,6 +2131,10 @@ public override void Up()
21292131
{
21302132
baz = 3,
21312133
})
2134+
.Row(new
2135+
{
2136+
baz = 4,
2137+
})
21322138
;
21332139
}
21342140

@@ -2162,6 +2168,17 @@ public override void Up()
21622168
{
21632169
baz = RawSql.Insert("= 3")
21642170
});
2171+
2172+
// UPDATE : Raw SQL with RawSql object inside an anonymous object (backward compatibility - no explicit operator)
2173+
Update.Table("Foo").InSchema("TestSchema")
2174+
.Set(new
2175+
{
2176+
baz = RawSql.Insert("CASE WHEN baz = 4 THEN 104 ELSE 0 END")
2177+
})
2178+
.Where(new
2179+
{
2180+
baz = RawSql.Insert("4")
2181+
});
21652182
}
21662183
}
21672184

@@ -2181,6 +2198,12 @@ public override void Up()
21812198
.Row(new
21822199
{
21832200
baz = RawSql.Insert("= 103")
2201+
})
2202+
2203+
// DELETE : Raw SQL with RawSql object inside an anonymous object (backward compatibility - no explicit operator)
2204+
.Row(new
2205+
{
2206+
baz = RawSql.Insert("104")
21842207
});
21852208
}
21862209
}

0 commit comments

Comments
 (0)