Skip to content

Commit

Permalink
Fi Unique_constraint test for 7.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vonzshik committed Feb 10, 2023
1 parent 7a5c449 commit 1335dd2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/Npgsql.Tests/SchemaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,16 @@ public async Task Unique_constraint()
Assert.That(columns.All(r => r["table_name"].Equals(table)));
Assert.That(columns.All(r => r["constraint_type"].Equals("UNIQUE KEY")));

Assert.That(columns[0]["column_name"], Is.EqualTo("f1"));
Assert.That(columns[0]["ordinal_number"], Is.EqualTo(1));
Assert.That(columns.Count, Is.EqualTo(2));

Assert.That(columns[1]["column_name"], Is.EqualTo("f2"));
Assert.That(columns[1]["ordinal_number"], Is.EqualTo(2));
// Columns are not necessarily in the correct order
var firstColumn = columns.FirstOrDefault(x => (string)x["column_name"] == "f1")!;
Assert.NotNull(firstColumn);
Assert.That(firstColumn["ordinal_number"], Is.EqualTo(1));

var secondColumn = columns.FirstOrDefault(x => (string)x["column_name"] == "f2")!;
Assert.NotNull(secondColumn);
Assert.That(secondColumn["ordinal_number"], Is.EqualTo(2));
}

[Test]
Expand Down

0 comments on commit 1335dd2

Please sign in to comment.