Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for array literals in migrations data #21044

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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