Skip to content

Commit 8c79d18

Browse files
committed
fix EG failures
1 parent 22b9e5d commit 8c79d18

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/MongoDB.Driver.Tests/Specifications/crud/prose-tests/CrudProseTests.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,9 @@ public async Task Ensure_generated_ids_are_first_fields_in_document_using_insert
637637
testCollection.InsertOne(document);
638638
}
639639

640-
eventCapturer.Next(); // skip the hello command that is captured.
641-
eventCapturer.Next().Should().BeOfType<CommandStartedEvent>()
642-
.Subject.Command["documents"][0].AsBsonDocument.Names.First().Should().Be("_id");
640+
var insertEvents = eventCapturer.Events.OfType<CommandStartedEvent>().Where(e => e.CommandName == "insert").ToArray();
641+
insertEvents.Length.Should().Be(1);
642+
insertEvents[0].Command["documents"][0].AsBsonDocument.Names.First().Should().Be("_id");
643643
document.Names.Should().Contain("_id");
644644
}
645645

@@ -661,9 +661,9 @@ public async Task Ensure_generated_ids_are_first_fields_in_document_using_collec
661661
testCollection.BulkWrite([new InsertOneModel<BsonDocument>(document)]);
662662
}
663663

664-
eventCapturer.Next(); // skip the hello command that is captured.
665-
eventCapturer.Next().Should().BeOfType<CommandStartedEvent>()
666-
.Subject.Command["documents"][0].AsBsonDocument.Names.First().Should().Be("_id");
664+
var insertEvents = eventCapturer.Events.OfType<CommandStartedEvent>().Where(e => e.CommandName == "insert").ToArray();
665+
insertEvents.Length.Should().Be(1);
666+
insertEvents[0].Command["documents"][0].AsBsonDocument.Names.First().Should().Be("_id");
667667
document.Names.Should().Contain("_id");
668668
}
669669

@@ -686,9 +686,9 @@ public async Task Ensure_generated_ids_are_first_fields_in_document_using_client
686686
client.BulkWrite([new BulkWriteInsertOneModel<BsonDocument>("test.test", document)]);
687687
}
688688

689-
eventCapturer.Next(); // skip the hello command that is captured.
690-
eventCapturer.Next().Should().BeOfType<CommandStartedEvent>()
691-
.Subject.Command["ops"][0]["document"].AsBsonDocument.Names.First().Should().Be("_id");
689+
var bulkEvents = eventCapturer.Events.OfType<CommandStartedEvent>().Where(e => e.CommandName == "bulkWrite").ToArray();
690+
bulkEvents.Length.Should().Be(1);
691+
bulkEvents[0].Command["ops"][0]["document"].AsBsonDocument.Names.First().Should().Be("_id");
692692
document.Names.Should().Contain("_id");
693693
}
694694

0 commit comments

Comments
 (0)