Skip to content

Commit ab80ca5

Browse files
fix Dapper tests
1 parent 6e5bbb0 commit ab80ca5

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Ydb.Sdk/tests/Dapper/DapperIntegrationTests.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
using Dapper;
44
using Xunit;
55
using Ydb.Sdk.Ado;
6+
using Ydb.Sdk.Tests.Ado.Specification;
7+
using Ydb.Sdk.Tests.Fixture;
68

79
namespace Ydb.Sdk.Tests.Dapper;
810

9-
public class DapperIntegrationTests
11+
public class DapperIntegrationTests : YdbAdoNetFixture
1012
{
1113
private static readonly TemporaryTables<DapperIntegrationTests> Tables = new();
1214

@@ -23,12 +25,9 @@ public async Task DapperYqlTutorialTests()
2325
.OfType<ColumnAttribute>()
2426
.Any(attr => attr.Name == columnName)) ?? throw new InvalidOperationException()));
2527

26-
await using var connection = new YdbConnection();
27-
await connection.OpenAsync();
28-
28+
await using var connection = await CreateOpenConnectionAsync();
2929
await connection.ExecuteAsync(Tables.CreateTables); // create tables
3030
await connection.ExecuteAsync(Tables.UpsertData); // adding data to table
31-
3231
var selectedEpisodes = (await connection.QueryAsync<Episode>($@"
3332
SELECT
3433
series_id,
@@ -206,7 +205,7 @@ public async Task NullableFieldSupported()
206205
{
207206
var tableName = "DapperNullableTypes_" + Random.Shared.Next();
208207

209-
await using var connection = new YdbConnection();
208+
await using var connection = await CreateOpenConnectionAsync();
210209
await connection.ExecuteAsync(@$"
211210
CREATE TABLE {tableName} (
212211
Id INT32,
@@ -270,4 +269,8 @@ private record Episode
270269
[Column("title")] public string Title { get; init; } = null!;
271270
[Column("air_date")] public DateTime AirDate { get; init; }
272271
}
272+
273+
protected DapperIntegrationTests(YdbFactoryFixture fixture) : base(fixture)
274+
{
275+
}
273276
}

0 commit comments

Comments
 (0)