Skip to content

Commit 0e2f6bf

Browse files
CSHARP-6069: Add await to async tests missing await (#2028)
1 parent a6d290d commit 0e2f6bf

3 files changed

Lines changed: 51 additions & 57 deletions

File tree

tests/MongoDB.Driver.Tests/IMongoClientExtensionsTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
using System.Threading;
17+
using System.Threading.Tasks;
1718
using MongoDB.Bson;
1819
using MongoDB.TestHelpers.XunitExtensions;
1920
using Moq;
@@ -25,7 +26,7 @@ public class IMongoClientExtensionsTests
2526
{
2627
[Theory]
2728
[ParameterAttributeData]
28-
public void Watch_should_call_client_with_expected_arguments(
29+
public async Task Watch_should_call_client_with_expected_arguments(
2930
[Values(false, true)] bool usingSession,
3031
[Values(false, true)] bool async)
3132
{
@@ -40,7 +41,7 @@ public void Watch_should_call_client_with_expected_arguments(
4041
{
4142
if (async)
4243
{
43-
client.WatchAsync(session, options, cancellationToken);
44+
await client.WatchAsync(session, options, cancellationToken);
4445
mockClient.Verify(m => m.WatchAsync(session, It.IsAny<EmptyPipelineDefinition<ChangeStreamDocument<BsonDocument>>>(), options, cancellationToken), Times.Once);
4546
}
4647
else
@@ -53,7 +54,7 @@ public void Watch_should_call_client_with_expected_arguments(
5354
{
5455
if (async)
5556
{
56-
client.WatchAsync(options, cancellationToken);
57+
await client.WatchAsync(options, cancellationToken);
5758
mockClient.Verify(m => m.WatchAsync(It.IsAny<EmptyPipelineDefinition<ChangeStreamDocument<BsonDocument>>>(), options, cancellationToken), Times.Once);
5859
}
5960
else

tests/MongoDB.Driver.Tests/IMongoDatabaseExtensionsTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
using System.Threading;
17+
using System.Threading.Tasks;
1718
using MongoDB.Bson;
1819
using MongoDB.TestHelpers.XunitExtensions;
1920
using Moq;
@@ -25,7 +26,7 @@ public class IMongoDatabaseExtensionsTests
2526
{
2627
[Theory]
2728
[ParameterAttributeData]
28-
public void Watch_should_call_client_with_expected_arguments(
29+
public async Task Watch_should_call_client_with_expected_arguments(
2930
[Values(false, true)] bool usingSession,
3031
[Values(false, true)] bool async)
3132
{
@@ -40,7 +41,7 @@ public void Watch_should_call_client_with_expected_arguments(
4041
{
4142
if (async)
4243
{
43-
database.WatchAsync(session, options, cancellationToken);
44+
await database.WatchAsync(session, options, cancellationToken);
4445
mockDatabase.Verify(m => m.WatchAsync(session, It.IsAny<EmptyPipelineDefinition<ChangeStreamDocument<BsonDocument>>>(), options, cancellationToken), Times.Once);
4546
}
4647
else
@@ -53,7 +54,7 @@ public void Watch_should_call_client_with_expected_arguments(
5354
{
5455
if (async)
5556
{
56-
database.WatchAsync(options, cancellationToken);
57+
await database.WatchAsync(options, cancellationToken);
5758
mockDatabase.Verify(m => m.WatchAsync(It.IsAny<EmptyPipelineDefinition<ChangeStreamDocument<BsonDocument>>>(), options, cancellationToken), Times.Once);
5859
}
5960
else

0 commit comments

Comments
 (0)