-
-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed SelectMany().LongCount() querying. Closes GH-3017
- Loading branch information
1 parent
b608a14
commit e8a2248
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Marten; | ||
using Marten.Testing.Documents; | ||
using Marten.Testing.Harness; | ||
using Shouldly; | ||
|
||
namespace LinqTests.Bugs; | ||
|
||
public class Bug_3017_SelectMany_with_LongCount : BugIntegrationContext | ||
{ | ||
[Fact] | ||
public async Task can_use_select_many_with_long_count() | ||
{ | ||
var targets = Target.GenerateRandomData(1000).ToArray(); | ||
|
||
await theStore.BulkInsertDocumentsAsync(targets); | ||
|
||
var expected = targets.SelectMany(x => x.Children).LongCount(); | ||
|
||
var actual = await theSession.Query<Target>().SelectMany(x => x.Children) | ||
.LongCountAsync(); | ||
|
||
actual.ShouldBe(expected); | ||
} | ||
|
||
[Fact] | ||
public async Task can_use_select_many_with_integer_count() | ||
{ | ||
var targets = Target.GenerateRandomData(1000).ToArray(); | ||
|
||
await theStore.BulkInsertDocumentsAsync(targets); | ||
|
||
var expected = targets.SelectMany(x => x.Children).Count(); | ||
|
||
var actual = await theSession.Query<Target>().SelectMany(x => x.Children) | ||
.CountAsync(); | ||
|
||
actual.ShouldBe(expected); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters