Skip to content

Commit

Permalink
Update DatabaseLevelTests.cs
Browse files Browse the repository at this point in the history
Narrowing down the exception possibilities: Oracle matches MS, Postgres ... doesn't throw even when cancelled. Hm.
  • Loading branch information
jas88 committed Jun 6, 2024
1 parent 885bce7 commit 6771984
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Tests/FAnsiTests/Database/DatabaseLevelTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using FAnsi.Discovery;
using FAnsi.Implementation;
using NUnit.Framework;
using NUnit.Framework.Constraints;
using TypeGuesser;

namespace FAnsiTests.Database;
Expand Down Expand Up @@ -58,7 +59,12 @@ public void TestListDatabasesAsync(DatabaseType type)
{
var db = GetTestDatabase(type, false);

var exceptionType = type == DatabaseType.MySql ? Throws.TypeOf<OperationCanceledException>() : Throws.TypeOf<TaskCanceledException>();
Constraint exceptionType = type switch
{
DatabaseType.MicrosoftSQLServer => Throws.TypeOf<TaskCanceledException>(),
DatabaseType.PostgreSql => Throws.Nothing,
_ => Throws.TypeOf<OperationCanceledException>()
};

Assert.That(
() => db.Server.Helper.ListDatabasesAsync(db.Server.Builder, new CancellationToken(true))
Expand Down

0 comments on commit 6771984

Please sign in to comment.