Skip to content

Commit

Permalink
Update DatabaseLevelTests.cs
Browse files Browse the repository at this point in the history
Fix up exception type for cancelled requests
  • Loading branch information
jas88 committed Jun 6, 2024
1 parent 83ca4f5 commit 885bce7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tests/FAnsiTests/Database/DatabaseLevelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ public void Test_CreateSchema(DatabaseType type)
public void TestListDatabasesAsync(DatabaseType type)
{
var db = GetTestDatabase(type, false);

var exceptionType = type == DatabaseType.MySql ? Throws.TypeOf<OperationCanceledException>() : Throws.TypeOf<TaskCanceledException>();

Assert.That(
() => db.Server.Helper.ListDatabasesAsync(db.Server.Builder, new CancellationToken(true))
.ToBlockingEnumerable().ToList(), Throws.TypeOf<TaskCanceledException>());
.ToBlockingEnumerable().ToList(), exceptionType);
var databases = db.Server.Helper.ListDatabasesAsync(db.Server.Builder, CancellationToken.None).ToBlockingEnumerable().ToList();
Assert.That(databases, Has.Member(db.GetRuntimeName()));
}
Expand Down

0 comments on commit 885bce7

Please sign in to comment.