Skip to content

Commit 94df8d2

Browse files
CSHARP-3391: Implement change stream oplog parsing code for delta oplog entries. (#472)
1 parent 8cfb892 commit 94df8d2

14 files changed

+267
-3
lines changed

tests/MongoDB.Driver.Tests/Specifications/change-streams/ChangeStreamTestRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ protected override string PathPrefix
569569
{
570570
get
571571
{
572-
return "MongoDB.Driver.Tests.Specifications.change_streams.tests.";
572+
return "MongoDB.Driver.Tests.Specifications.change_streams.tests.legacy.";
573573
}
574574
}
575575

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/* Copyright 2021-present MongoDB Inc.
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
16+
using System.Collections.Generic;
17+
using MongoDB.Bson;
18+
using MongoDB.Bson.TestHelpers.JsonDrivenTests;
19+
using MongoDB.Driver.Tests.Specifications.unified_test_format;
20+
using Xunit;
21+
22+
namespace MongoDB.Driver.Tests.Specifications.crud.Unified
23+
{
24+
public sealed class ChangeStreamUnifiedTestRunner
25+
{
26+
[SkippableTheory]
27+
[ClassData(typeof(TestCaseFactory))]
28+
public void Run(JsonDrivenTestCase testCase)
29+
{
30+
using (var runner = new UnifiedTestFormatTestRunner())
31+
{
32+
runner.Run(testCase);
33+
}
34+
}
35+
36+
// nested types
37+
public class TestCaseFactory : JsonDrivenTestCaseFactory
38+
{
39+
// protected properties
40+
protected override string PathPrefix => "MongoDB.Driver.Tests.Specifications.change_streams.tests.unified.";
41+
42+
// protected methods
43+
protected override IEnumerable<JsonDrivenTestCase> CreateTestCases(BsonDocument document)
44+
{
45+
foreach (var testCase in base.CreateTestCases(document))
46+
{
47+
foreach (var async in new[] { false, true })
48+
{
49+
var name = $"{testCase.Name}:async={async}";
50+
var test = testCase.Test.DeepClone().AsBsonDocument.Add("async", async);
51+
yield return new JsonDrivenTestCase(name, testCase.Shared, test);
52+
}
53+
}
54+
}
55+
}
56+
}
57+
}

0 commit comments

Comments
 (0)