Skip to content

Commit 8cc8b73

Browse files
committed
fix(tests): await using for connections/readers
1 parent b9c64ec commit 8cc8b73

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Ydb.Sdk/test/Ydb.Sdk.Ado.Tests/YdbConnectionTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public async Task SetConnectionString_WhenConnectionIsOpen_ThrowException()
6969
[Fact]
7070
public async Task BeginTransaction_WhenConnectionIsClosed_ThrowException()
7171
{
72-
var ydbConnection = await CreateOpenConnectionAsync();
72+
await using var ydbConnection = await CreateOpenConnectionAsync();
7373
await ydbConnection.CloseAsync();
7474
Assert.Equal("Connection is closed",
7575
Assert.Throws<InvalidOperationException>(() => ydbConnection.BeginTransaction()).Message);
@@ -78,7 +78,7 @@ public async Task BeginTransaction_WhenConnectionIsClosed_ThrowException()
7878
[Fact]
7979
public async Task ExecuteScalar_WhenConnectionIsClosed_ThrowException()
8080
{
81-
var ydbConnection = await CreateOpenConnectionAsync();
81+
await using var ydbConnection = await CreateOpenConnectionAsync();
8282
await ydbConnection.CloseAsync();
8383

8484
var ydbCommand = ydbConnection.CreateCommand();
@@ -91,7 +91,7 @@ public async Task ExecuteScalar_WhenConnectionIsClosed_ThrowException()
9191
[Fact]
9292
public async Task ClosedYdbDataReader_WhenConnectionIsClosed_ThrowException()
9393
{
94-
var ydbConnection = await CreateOpenConnectionAsync();
94+
await using var ydbConnection = await CreateOpenConnectionAsync();
9595

9696
var ydbCommand = ydbConnection.CreateCommand();
9797
ydbCommand.CommandText = "SELECT 1; SELECT 2; SELECT 3;";
@@ -107,7 +107,7 @@ public async Task ClosedYdbDataReader_WhenConnectionIsClosed_ThrowException()
107107
[Fact]
108108
public async Task SetNulls_WhenTableAllTypes_SussesSet()
109109
{
110-
var ydbConnection = await CreateOpenConnectionAsync();
110+
await using var ydbConnection = await CreateOpenConnectionAsync();
111111
var ydbCommand = ydbConnection.CreateCommand();
112112
var tableName = "AllTypes_" + Random.Shared.Next();
113113

0 commit comments

Comments
 (0)