From b45e3be149e2e817b5670c766b5166900de39550 Mon Sep 17 00:00:00 2001 From: "Jeremy D. Miller" Date: Tue, 29 Oct 2024 09:54:33 -0500 Subject: [PATCH] extra test for Select() + paging + value type --- .../linq_querying_with_value_types.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ValueTypeTests/linq_querying_with_value_types.cs b/src/ValueTypeTests/linq_querying_with_value_types.cs index 9ba590af30..b92d520f47 100644 --- a/src/ValueTypeTests/linq_querying_with_value_types.cs +++ b/src/ValueTypeTests/linq_querying_with_value_types.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Marten; using Marten.Linq; +using Marten.Pagination; using Marten.Testing.Harness; using Vogen; @@ -73,6 +74,27 @@ public async Task store_several_and_query_by() ordered.ShouldHaveTheSameElementsAs(doc4.Id); } + [Fact] + public async Task store_several_and_query_by_with_paging() + { + var doc1 = new LimitedDoc { Lower = LowerLimit.From(1), Upper = UpperLimit.From(20) }; + var doc2 = new LimitedDoc { Lower = LowerLimit.From(5), Upper = UpperLimit.From(25) }; + var doc3 = new LimitedDoc { Lower = LowerLimit.From(4), Upper = UpperLimit.From(15) }; + var doc4 = new LimitedDoc { Lower = LowerLimit.From(3), Upper = UpperLimit.From(10) }; + + theSession.Store(doc1, doc2, doc3, doc4); + await theSession.SaveChangesAsync(); + + var ordered = await theSession + .Query() + .OrderBy(x => x.Lower) + .Where(x => x.Upper == UpperLimit.From(10)) + .Select(x => x.Id) + .ToPagedListAsync(1, 10); + + ordered.ShouldHaveTheSameElementsAs(doc4.Id); + } + [Fact] public async Task use_value_type_as_parameter_in_compiled_query() {