Skip to content

Commit ec46c34

Browse files
CSHARP-4490: Fix tests related to asserting wildcardProjection output. (#1011)
1 parent 9ee046b commit ec46c34

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tests/MongoDB.Driver.Legacy.Tests/Builders/IndexKeysBuilderTests.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public void CreateIndex_with_wildcardProjection_should_create_expected_index()
7070
var index = indexes.RawDocuments.Single(i => i["name"].AsString == "custom");
7171

7272
index["key"]["$**"].AsInt32.Should().Be(1);
73-
if (CoreTestConfiguration.ServerVersion >= new SemanticVersion(4, 5, 0, ""))
73+
var serverVersion = CoreTestConfiguration.ServerVersion;
74+
if (serverVersion >= new SemanticVersion(4, 5, 0, "") && serverVersion <= new SemanticVersion(6, 2, 0, ""))
7475
{
7576
index["wildcardProjection"].Should().Be(BsonDocument.Parse("{ _id : true }"));
7677
}

tests/MongoDB.Driver.Legacy.Tests/Builders/IndexKeysBuilderTypedTests.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public void CreateIndex_with_wildcardProjection_should_create_expected_index()
8989
var indexes = collection.GetIndexes();
9090
var index = indexes.RawDocuments.Single(i => i["name"].AsString == "custom");
9191
index["key"]["$**"].AsInt32.Should().Be(1);
92-
if (CoreTestConfiguration.ServerVersion >= new SemanticVersion(4, 5, 0, ""))
92+
var serverVersion = CoreTestConfiguration.ServerVersion;
93+
if (serverVersion >= new SemanticVersion(4, 5, 0, "") && serverVersion <= new SemanticVersion(6, 2, 0, ""))
9394
{
9495
index["wildcardProjection"].Should().Be(BsonDocument.Parse("{ b : true, _id : false }"));
9596
}

0 commit comments

Comments
 (0)