Skip to content

Commit

Permalink
CSHARP-4804: Fix some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rstam committed Oct 6, 2023
1 parent 0908cb0 commit 82c573b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/MongoDB.Driver.Tests/ProjectionDefinitionBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,33 +167,33 @@ public void Slice()
{
var subject = CreateSubject<BsonDocument>();

Assert(subject.Slice("a", 10), "{a: {$slice: 10}}");
Assert(subject.Slice("a", 10), "{a: {$slice: ['$a', 10]}}");
}

[Fact]
public void Slice_Typed()
{
var subject = CreateSubject<Person>();

Assert(subject.Slice(x => x.Pets, 10), "{pets: {$slice: 10}}");
Assert(subject.Slice("Pets", 10), "{pets: {$slice: 10}}");
Assert(subject.Slice(x => x.Pets, 10), "{pets: {$slice: ['$pets', 10]}}");
Assert(subject.Slice("Pets", 10), "{pets: {$slice: ['$pets', 10]}}");
}

[Fact]
public void Slice_with_limit()
{
var subject = CreateSubject<BsonDocument>();

Assert(subject.Slice("a", 10, 20), "{a: {$slice: [10, 20]}}");
Assert(subject.Slice("a", 10, 20), "{a: {$slice: ['$a', 10, 20]}}");
}

[Fact]
public void Slice_Typed_with_limit()
{
var subject = CreateSubject<Person>();

Assert(subject.Slice(x => x.Pets, 10, 20), "{pets: {$slice: [10, 20]}}");
Assert(subject.Slice("Pets", 10, 20), "{pets: {$slice: [10, 20]}}");
Assert(subject.Slice(x => x.Pets, 10, 20), "{pets: {$slice: ['$pets', 10, 20]}}");
Assert(subject.Slice("Pets", 10, 20), "{pets: {$slice: ['$pets', 10, 20]}}");
}

private void Assert<TDocument>(ProjectionDefinition<TDocument> projection, string expectedJson, LinqProvider linqProvider = LinqProvider.V3)
Expand Down

0 comments on commit 82c573b

Please sign in to comment.