Skip to content

Commit a52142b

Browse files
committed
Clean up test variable names. Use ConcurrentBag in tests to avoid concurrency issue.
1 parent 8c8c3f4 commit a52142b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Microsoft.Data.SqlClient/tests/UnitTests/ConnectionPool/TransactedConnectionPoolTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ public void GetTransactedObject_WithNonExistentTransaction_ReturnsNull()
6060
{
6161
// Arrange
6262
var transactedPool = new TransactedConnectionPool(new MockDbConnectionPool());
63-
using var transaction = new TransactionScope();
63+
using var transactionScope = new TransactionScope();
64+
var transaction = Transaction.Current!;
6465

6566
// Act
66-
var result = transactedPool.GetTransactedObject(Transaction.Current!);
67+
var result = transactedPool.GetTransactedObject(transaction);
6768

6869
// Assert
6970
Assert.Null(result);
@@ -669,7 +670,7 @@ internal class MockDbConnectionPool : IDbConnectionPool
669670
public DbConnectionPoolState State => throw new NotImplementedException();
670671
public bool UseLoadBalancing => throw new NotImplementedException();
671672

672-
public List<DbConnectionInternal> ReturnedConnections { get; } = new();
673+
public ConcurrentBag<DbConnectionInternal> ReturnedConnections { get; } = new();
673674

674675
public void Clear() => throw new NotImplementedException();
675676

0 commit comments

Comments
 (0)