Skip to content

Commit

Permalink
Tests for array literals in migrations data
Browse files Browse the repository at this point in the history
Fixes #20432

Issue was already fixed in 5.0. Adding tests.
  • Loading branch information
ajcvickers committed May 25, 2020
1 parent 7641cc3 commit db977bf
Showing 1 changed file with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2664,6 +2664,61 @@ public void InsertDataOperation_required_args()
});
}

[ConditionalFact]
public void InsertDataOperation_required_empty_array()
{
Test(
new InsertDataOperation
{
Table = "People",
Columns = new[] { "Tags" },
Values = new object[,] { { new string[0] } }
},
"mb.InsertData("
+ _eol
+ " table: \"People\","
+ _eol
+ " column: \"Tags\","
+ _eol
+ " value: new string[0]);",
o =>
{
Assert.Equal("People", o.Table);
Assert.Single(o.Columns);
Assert.Equal(1, o.Values.GetLength(0));
Assert.Equal(1, o.Values.GetLength(1));
Assert.Equal(new string[0], (string[])o.Values[0, 0]);
});
}

[ConditionalFact]
public void InsertDataOperation_required_empty_array_composite()
{
Test(
new InsertDataOperation
{
Table = "People",
Columns = new[] { "First Name", "Last Name", "Geometry" },
Values = new object[,] { { "John", "Snow", new string[0] } }
},
"mb.InsertData("
+ _eol
+ " table: \"People\","
+ _eol
+ " columns: new[] { \"First Name\", \"Last Name\", \"Geometry\" },"
+ _eol
+ " values: new object[] { \"John\", \"Snow\", new string[0] });",
o =>
{
Assert.Equal("People", o.Table);
Assert.Equal(3, o.Columns.Length);
Assert.Equal(1, o.Values.GetLength(0));
Assert.Equal(3, o.Values.GetLength(1));
Assert.Equal("Snow", o.Values[0, 1]);
Assert.Equal(new string[0], (string[])o.Values[0, 2]);
});
}

[ConditionalFact]
public void InsertDataOperation_required_args_composite()
{
Expand Down

0 comments on commit db977bf

Please sign in to comment.