Skip to content

Commit ae9e389

Browse files
authored
Update HashFieldTests.cs
1 parent ffb7ee9 commit ae9e389

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

tests/StackExchange.Redis.Tests/HashFieldTests.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,8 @@ public void HashFieldPersistNoField()
303303
[Fact]
304304
public void HashFieldGetAndSetExpiry()
305305
{
306-
var db = Create(require: RedisFeatures.v8_0_0_M04).GetDatabase();
306+
using var conn = Create(require: RedisFeatures.v8_0_0_M04);
307+
var db = conn.GetDatabase();
307308
var hashKey = Me();
308309

309310
// testing with timespan
@@ -350,9 +351,10 @@ public void HashFieldGetAndSetExpiry()
350351
}
351352

352353
[Fact]
353-
public async void HashFieldGetAndSetExpiryAsync()
354+
public async Task HashFieldGetAndSetExpiryAsync()
354355
{
355-
var db = Create(require: RedisFeatures.v8_0_0_M04).GetDatabase();
356+
await using var conn = Create(require: RedisFeatures.v8_0_0_M04);
357+
var db = conn.GetDatabase();
356358
var hashKey = Me();
357359

358360
// testing with timespan
@@ -401,7 +403,8 @@ public async void HashFieldGetAndSetExpiryAsync()
401403
[Fact]
402404
public void HashFieldSetAndSetExpiry()
403405
{
404-
var db = Create(require: RedisFeatures.v8_0_0_M04).GetDatabase();
406+
using var conn = Create(require: RedisFeatures.v8_0_0_M04);
407+
var db = conn.GetDatabase();
405408
var hashKey = Me();
406409

407410
// testing with timespan
@@ -464,7 +467,8 @@ public void HashFieldSetAndSetExpiry()
464467
[Fact]
465468
public async Task HashFieldSetAndSetExpiryAsync()
466469
{
467-
var db = Create(require: RedisFeatures.v8_0_0_M04).GetDatabase();
470+
await using var conn = Create(require: RedisFeatures.v8_0_0_M04);
471+
var db = conn.GetDatabase();
468472
var hashKey = Me();
469473

470474
// testing with timespan
@@ -526,7 +530,8 @@ public async Task HashFieldSetAndSetExpiryAsync()
526530
[Fact]
527531
public void HashFieldGetAndDelete()
528532
{
529-
var db = Create(require: RedisFeatures.v8_0_0_M04).GetDatabase();
533+
using var conn = Create(require: RedisFeatures.v8_0_0_M04);
534+
var db = conn.GetDatabase();
530535
var hashKey = Me();
531536

532537
// single field
@@ -544,9 +549,10 @@ public void HashFieldGetAndDelete()
544549
}
545550

546551
[Fact]
547-
public async void HashFieldGetAndDeleteAsync()
552+
public async Task HashFieldGetAndDeleteAsync()
548553
{
549-
var db = Create(require: RedisFeatures.v8_0_0_M04).GetDatabase();
554+
await using var conn = Create(require: RedisFeatures.v8_0_0_M04);
555+
var db = conn.GetDatabase();
550556
var hashKey = Me();
551557

552558
// single field

0 commit comments

Comments
 (0)