Skip to content
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 @@ -87,7 +87,7 @@ public void TransientFaultTest(uint errorCode)
[InlineData(42108)]
[InlineData(42109)]
[PlatformSpecific(TestPlatforms.Windows)]
public async Task TransientFaultDisabledTestAsync(uint errorCode)
public void TransientFaultDisabledTestAsync(uint errorCode)
{
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, true, errorCode);
SqlConnectionStringBuilder builder = new()
Expand All @@ -99,17 +99,9 @@ public async Task TransientFaultDisabledTestAsync(uint errorCode)
};

using SqlConnection connection = new(builder.ConnectionString);
try
{
await connection.OpenAsync();
Assert.False(true, "Connection should not have opened.");
}
catch (SqlException e)
{
// FATAL Error, should result in closed connection.
Assert.Equal(20, e.Class);
Assert.Equal(ConnectionState.Closed, connection.State);
}
Task<SqlException> e = Assert.ThrowsAsync<SqlException>(async () => await connection.OpenAsync());
Assert.Equal(20, e.Result.Class);
Assert.Equal(ConnectionState.Closed, connection.State);
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArmProcess))]
Expand All @@ -129,17 +121,9 @@ public void TransientFaultDisabledTest(uint errorCode)
};

using SqlConnection connection = new(builder.ConnectionString);
try
{
connection.Open();
Assert.False(true, "Connection should not have opened.");
}
catch (SqlException e)
{
// FATAL Error, should result in closed connection.
Assert.Equal(20, e.Class);
Assert.Equal(ConnectionState.Closed, connection.State);
}
SqlException e = Assert.Throws<SqlException>(() => connection.Open());
Assert.Equal(20, e.Class);
Assert.Equal(ConnectionState.Closed, connection.State);
}

[Fact]
Expand Down