Skip to content

Commit e70abd8

Browse files
authored
CSHARP-4735: Flaky AtlasSearchTests.MustNot test (#1145)
1 parent 96149cb commit e70abd8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/MongoDB.Driver.Tests/Search/AtlasSearchTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,9 @@ public void MustNot()
231231
{
232232
var result = SearchSingle(
233233
Builders.Search.Compound().MustNot(
234-
Builders.Search.Phrase(x => x.Body, "life, liberty")));
235-
result.Title.Should().Be("Gettysburg Address");
234+
Builders.Search.Phrase(x => x.Body, "life, liberty")),
235+
sort: Builders.Sort.Descending(x => x.Title));
236+
result.Title.Should().Be("US Constitution");
236237
}
237238

238239
[Fact]
@@ -467,9 +468,12 @@ public void Wildcard()
467468
private List<AirbnbListing> GeoSearch(SearchDefinition<AirbnbListing> searchDefintion) =>
468469
GetGeoTestCollection().Aggregate().Search(searchDefintion).ToList();
469470

470-
private HistoricalDocument SearchSingle(SearchDefinition<HistoricalDocument> searchDefintion, ProjectionDefinition<HistoricalDocument, HistoricalDocument> projectionDefinition = null)
471+
private HistoricalDocument SearchSingle(
472+
SearchDefinition<HistoricalDocument> searchDefintion,
473+
ProjectionDefinition<HistoricalDocument, HistoricalDocument> projectionDefinition = null,
474+
SortDefinition<HistoricalDocument> sort = null)
471475
{
472-
var fluent = GetTestCollection().Aggregate().Search(searchDefintion);
476+
var fluent = GetTestCollection().Aggregate().Search(searchDefintion, sort: sort);
473477

474478
if (projectionDefinition != null)
475479
{

0 commit comments

Comments
 (0)