-
-
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.
Test to verify that deep nested accessors work in Select() functions. C…
…loses GH-3350
- Loading branch information
1 parent
81b1241
commit 167914a
Showing
1 changed file
with
35 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,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; } | ||
} |