Skip to content

Commit

Permalink
Test to verify that deep nested accessors work in Select() functions. C…
Browse files Browse the repository at this point in the history
…loses GH-3350
  • Loading branch information
jeremydmiller committed Aug 4, 2024
1 parent 81b1241 commit 167914a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/LinqTests/Bugs/Bug_3350_Select_with_deep_accessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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_3350_Select_with_deep_accessor : BugIntegrationContext
{
[Fact]
public async Task get_the_deeply_nested_value_in_select()
{
await theStore.BulkInsertAsync(Target.GenerateRandomData(1000).ToArray());

var views = await theSession.Query<Target>()
.Where(x => x.Inner != null && x.Inner.String != null)
.Select(x => new SelectedView { Number = x.Number, Text = x.Inner.String }).ToListAsync();

views.ShouldNotBeEmpty();

foreach (var view in views)
{
view.Text.ShouldNotBeNullOrEmpty();
}

}
}

public class SelectedView
{
public string Text { get; set; }
public int Number { get; set; }
}

0 comments on commit 167914a

Please sign in to comment.