forked from JasperFx/marten
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request JasperFx#149 from nieve/where-modulo
added support for modulo where queries
- Loading branch information
Showing
3 changed files
with
40 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,27 @@ | ||
using System.Linq; | ||
using Marten.Services; | ||
using Marten.Testing.Fixtures; | ||
using Xunit; | ||
|
||
namespace Marten.Testing.Linq | ||
{ | ||
public class query_with_modulo_Tests : DocumentSessionFixture<NulloIdentityMap> | ||
{ | ||
[Fact] | ||
public void use_modulo() | ||
{ | ||
theSession.Store(new Target{Color = Colors.Blue, Number = 1}); | ||
theSession.Store(new Target{Color = Colors.Blue, Number = 2}); | ||
theSession.Store(new Target{Color = Colors.Blue, Number = 3}); | ||
theSession.Store(new Target{Color = Colors.Blue, Number = 4}); | ||
theSession.Store(new Target{Color = Colors.Blue, Number = 5}); | ||
theSession.Store(new Target{Color = Colors.Green, Number = 6}); | ||
|
||
theSession.SaveChanges(); | ||
|
||
theSession.Query<Target>().Where(x => x.Number % 2 == 0 && x.Color == Colors.Blue).ToArray() | ||
.Select(x => x.Number) | ||
.ShouldHaveTheSameElementsAs(2, 4); | ||
} | ||
} | ||
} |
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
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