Skip to content

Commit e6b3e5a

Browse files
CSHARP-2867: Fix json driven tests for async
1 parent 0953908 commit e6b3e5a

8 files changed

+53
-18
lines changed

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertDifferentLsidOnLastTwoCommandsTest.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Collections.Generic;
2121
using System.Linq;
2222
using System.Threading;
23+
using System.Threading.Tasks;
2324

2425
namespace MongoDB.Driver.Tests.JsonDrivenTests
2526
{
@@ -38,7 +39,13 @@ public override void Act(CancellationToken cancellationToken)
3839
// do nothing
3940
}
4041

41-
public override void Assert()
42+
public override Task ActAsync(CancellationToken cancellationToken)
43+
{
44+
// do nothing
45+
return Task.FromResult(true);
46+
}
47+
48+
protected override void AssertResult()
4249
{
4350
var lastTwoCommands = _eventCapturer
4451
.Events

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertSameLsidOnLastTwoCommandsTest.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.Collections.Generic;
2121
using System.Linq;
2222
using System.Threading;
23+
using System.Threading.Tasks;
2324

2425
namespace MongoDB.Driver.Tests.JsonDrivenTests
2526
{
@@ -38,7 +39,13 @@ public override void Act(CancellationToken cancellationToken)
3839
// do nothing
3940
}
4041

41-
public override void Assert()
42+
public override Task ActAsync(CancellationToken cancellationToken)
43+
{
44+
// do nothing
45+
return Task.FromResult(true);
46+
}
47+
48+
protected override void AssertResult()
4249
{
4350
var lastTwoCommands = _eventCapturer
4451
.Events

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertSessionDirtyTest.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
using System.Collections.Generic;
1717
using System.Threading;
18+
using System.Threading.Tasks;
1819
using FluentAssertions;
1920

2021
namespace MongoDB.Driver.Tests.JsonDrivenTests
@@ -31,7 +32,13 @@ public override void Act(CancellationToken cancellationToken)
3132
// do nothing
3233
}
3334

34-
public override void Assert()
35+
public override Task ActAsync(CancellationToken cancellationToken)
36+
{
37+
// do nothing
38+
return Task.FromResult(true);
39+
}
40+
41+
protected override void AssertResult()
3542
{
3643
CoreSession.IsDirty.Should().BeTrue();
3744
}

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertSessionNotDirtyTest.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
using System.Collections.Generic;
1717
using System.Threading;
18+
using System.Threading.Tasks;
1819
using FluentAssertions;
1920

2021
namespace MongoDB.Driver.Tests.JsonDrivenTests
@@ -31,7 +32,13 @@ public override void Act(CancellationToken cancellationToken)
3132
// do nothing
3233
}
3334

34-
public override void Assert()
35+
public override Task ActAsync(CancellationToken cancellationToken)
36+
{
37+
// do nothing
38+
return Task.FromResult(true);
39+
}
40+
41+
protected override void AssertResult()
3542
{
3643
CoreSession.IsDirty.Should().BeFalse();
3744
}

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertSessionPinnedTest.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515

1616
using System.Collections.Generic;
1717
using System.Threading;
18+
using System.Threading.Tasks;
1819
using FluentAssertions;
19-
using MongoDB.Bson;
20-
using MongoDB.Driver.Core.Misc;
21-
using MongoDB.Driver.Core.TestHelpers;
2220

2321
namespace MongoDB.Driver.Tests.JsonDrivenTests
2422
{
@@ -31,9 +29,16 @@ public JsonDrivenAssertSessionPinnedTest(IJsonDrivenTestRunner testRunner, Dicti
3129

3230
public override void Act(CancellationToken cancellationToken)
3331
{
32+
// do nothing
3433
}
3534

36-
public override void Assert()
35+
public override Task ActAsync(CancellationToken cancellationToken)
36+
{
37+
// do nothing
38+
return Task.FromResult(true);
39+
}
40+
41+
protected override void AssertResult()
3742
{
3843
GetPinnedServer().Should().NotBeNull();
3944
}

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertSessionTransactionStateTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override Task ActAsync(CancellationToken cancellationToken)
4545
return Task.FromResult(true);
4646
}
4747

48-
public override void Assert()
48+
protected override void AssertResult()
4949
{
5050
CoreSession.CurrentTransaction.State.Should().Be(_state);
5151
}

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenAssertSessionUnpinnedTest.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515

1616
using System.Collections.Generic;
1717
using System.Threading;
18+
using System.Threading.Tasks;
1819
using FluentAssertions;
19-
using MongoDB.Bson;
20-
using MongoDB.Driver.Core.Misc;
21-
using MongoDB.Driver.Core.TestHelpers;
2220

2321
namespace MongoDB.Driver.Tests.JsonDrivenTests
2422
{
@@ -31,9 +29,16 @@ public JsonDrivenAssertSessionUnpinnedTest(IJsonDrivenTestRunner testRunner, Dic
3129

3230
public override void Act(CancellationToken cancellationToken)
3331
{
32+
// do nothing
3433
}
3534

36-
public override void Assert()
35+
public override Task ActAsync(CancellationToken cancellationToken)
36+
{
37+
// do nothing
38+
return Task.FromResult(true);
39+
}
40+
41+
protected override void AssertResult()
3742
{
3843
GetPinnedServer().Should().BeNull();
3944
}

tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenTargetedFailPoint.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@
1313
* limitations under the License.
1414
*/
1515

16-
using System;
1716
using System.Collections.Generic;
1817
using System.Threading;
1918
using System.Threading.Tasks;
2019
using FluentAssertions;
2120
using MongoDB.Bson;
2221
using MongoDB.Driver.Core.Bindings;
23-
using MongoDB.Driver.Core.Misc;
24-
using MongoDB.Driver.Core.Servers;
25-
using MongoDB.Driver.Core.TestHelpers;
2622

2723
namespace MongoDB.Driver.Tests.JsonDrivenTests
2824
{
@@ -50,8 +46,9 @@ protected override Task CallMethodAsync(CancellationToken cancellationToken)
5046
return TestRunner.ConfigureFailPointAsync(pinnedServer, NoCoreSession.NewHandle(), _failCommand);
5147
}
5248

53-
public override void Assert()
49+
protected override void AssertResult()
5450
{
51+
// do nothing
5552
}
5653

5754
protected override void SetArgument(string name, BsonValue value)

0 commit comments

Comments
 (0)