-
-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dealing with literal boolean values in complex WHERE clauses. Closes G…
- Loading branch information
1 parent
282a355
commit bc46d29
Showing
2 changed files
with
43 additions
and
12 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,31 @@ | ||
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_2850_missed_field_reducing : BugIntegrationContext | ||
{ | ||
public async Task RunQuery(bool include, int resultCount) | ||
{ | ||
var results = await theSession.Query<Target>().Where(x => include || !x.Flag).CountAsync(); | ||
results.ShouldBe(resultCount); | ||
} | ||
|
||
[Fact] | ||
public async Task pass_bool_into_query() | ||
{ | ||
await theStore.Advanced.Clean.DeleteDocumentsByTypeAsync(typeof(Target)); | ||
|
||
var targets = Target.GenerateRandomData(100).ToArray(); | ||
await theStore.BulkInsertAsync(targets); | ||
|
||
var count = targets.Count(x => x.Flag); | ||
|
||
await RunQuery(true, 100); | ||
await RunQuery(false, 100 - count); | ||
} | ||
} |
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