Skip to content

Commit b6a1d89

Browse files
fix tests
1 parent 28b039b commit b6a1d89

File tree

1 file changed

+30
-33
lines changed

1 file changed

+30
-33
lines changed

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

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -316,21 +316,22 @@ public async Task BulkUpsertImporter_HappyPath_Add_Flush()
316316
{
317317
await using (var createCmd = conn.CreateCommand())
318318
{
319-
createCmd.CommandText = $@"
320-
CREATE TABLE {tableName} (
321-
Id Int32,
322-
Name Utf8,
323-
PRIMARY KEY (Id)
324-
)";
319+
createCmd.CommandText = $"""
320+
CREATE TABLE {tableName} (
321+
Id Int32,
322+
Name Utf8,
323+
PRIMARY KEY (Id)
324+
)
325+
""";
325326
await createCmd.ExecuteNonQueryAsync();
326327
}
327328

328329
var columns = new[] { "Id", "Name" };
329330

330331
var importer = conn.BeginBulkUpsertImport(tableName, columns);
331332

332-
await importer.AddRowAsync([YdbValue.MakeInt32(1), YdbValue.MakeUtf8("Alice")]);
333-
await importer.AddRowAsync([YdbValue.MakeInt32(2), YdbValue.MakeUtf8("Bob")]);
333+
await importer.AddRowAsync(YdbValue.MakeInt32(1), YdbValue.MakeUtf8("Alice"));
334+
await importer.AddRowAsync(YdbValue.MakeInt32(2), YdbValue.MakeUtf8("Bob"));
334335
await importer.FlushAsync();
335336

336337
await using (var checkCmd = conn.CreateCommand())
@@ -341,8 +342,8 @@ PRIMARY KEY (Id)
341342
}
342343

343344
importer = conn.BeginBulkUpsertImport(tableName, columns);
344-
await importer.AddRowAsync([YdbValue.MakeInt32(3), YdbValue.MakeUtf8("Charlie")]);
345-
await importer.AddRowAsync([YdbValue.MakeInt32(4), YdbValue.MakeUtf8("Diana")]);
345+
await importer.AddRowAsync(YdbValue.MakeInt32(3), YdbValue.MakeUtf8("Charlie"));
346+
await importer.AddRowAsync(YdbValue.MakeInt32(4), YdbValue.MakeUtf8("Diana"));
346347
await importer.FlushAsync();
347348

348349
await using (var checkCmd = conn.CreateCommand())
@@ -375,28 +376,22 @@ public async Task BulkUpsertImporter_ThrowsOnInvalidRowCount()
375376
{
376377
await using (var createCmd = conn.CreateCommand())
377378
{
378-
createCmd.CommandText = $@"
379-
CREATE TABLE {tableName} (
380-
Id Int32,
381-
Name Utf8,
382-
PRIMARY KEY (Id)
383-
)";
379+
createCmd.CommandText = $"""
380+
CREATE TABLE {tableName} (
381+
Id Int32,
382+
Name Utf8,
383+
PRIMARY KEY (Id)
384+
)
385+
""";
384386
await createCmd.ExecuteNonQueryAsync();
385387
}
386388

387389
var columns = new[] { "Id", "Name" };
388390

389391
var importer = conn.BeginBulkUpsertImport(tableName, columns);
390392

391-
var badRow = new object?[] { YdbValue.MakeInt32(1) };
392-
await Assert.ThrowsAsync<ArgumentException>(async () => await importer.AddRowAsync([badRow]));
393-
394-
await Assert.ThrowsAsync<ArgumentException>(async () =>
395-
{
396-
await importer.AddRowAsync([
397-
new object?[] { YdbValue.MakeInt32(2) }
398-
]);
399-
});
393+
await Assert.ThrowsAsync<ArgumentException>(async () => await importer.AddRowAsync(1));
394+
await Assert.ThrowsAsync<ArgumentException>(async () => await importer.AddRowAsync(2));
400395
}
401396
finally
402397
{
@@ -418,11 +413,13 @@ public async Task BulkUpsertImporter_MultipleImporters_Parallel()
418413
foreach (var table in new[] { table1, table2 })
419414
{
420415
await using var createCmd = conn.CreateCommand();
421-
createCmd.CommandText = $@"CREATE TABLE {table} (
422-
Id Int32,
423-
Name Utf8,
424-
PRIMARY KEY (Id)
425-
)";
416+
createCmd.CommandText = $"""
417+
CREATE TABLE {table} (
418+
Id Int32,
419+
Name Utf8,
420+
PRIMARY KEY (Id)
421+
)
422+
""";
426423
await createCmd.ExecuteNonQueryAsync();
427424
}
428425

@@ -433,7 +430,7 @@ await Task.WhenAll(
433430
{
434431
var importer = conn.BeginBulkUpsertImport(table1, columns);
435432
var rows = Enumerable.Range(0, 20)
436-
.Select(i => new object?[] { YdbValue.MakeInt32(i), YdbValue.MakeUtf8($"A{i}") })
433+
.Select(i => new object[] { YdbValue.MakeInt32(i), YdbValue.MakeUtf8($"A{i}") })
437434
.ToArray();
438435
foreach (var row in rows)
439436
await importer.AddRowAsync(row);
@@ -443,7 +440,7 @@ await Task.WhenAll(
443440
{
444441
var importer = conn.BeginBulkUpsertImport(table2, columns);
445442
var rows = Enumerable.Range(0, 20)
446-
.Select(i => new object?[] { YdbValue.MakeInt32(i), YdbValue.MakeUtf8($"B{i}") })
443+
.Select(i => new object[] { YdbValue.MakeInt32(i), YdbValue.MakeUtf8($"B{i}") })
447444
.ToArray();
448445
foreach (var row in rows)
449446
await importer.AddRowAsync(row);
@@ -482,7 +479,7 @@ public async Task BulkUpsertImporter_ThrowsOnNonexistentTable()
482479

483480
var importer = conn.BeginBulkUpsertImport(tableName, columns);
484481

485-
await importer.AddRowAsync([YdbValue.MakeInt32(1), YdbValue.MakeUtf8("NotExists")]);
482+
await importer.AddRowAsync(YdbValue.MakeInt32(1), YdbValue.MakeUtf8("NotExists"));
486483

487484
await Assert.ThrowsAsync<YdbException>(async () => { await importer.FlushAsync(); });
488485
}

0 commit comments

Comments
 (0)