-
-
Notifications
You must be signed in to change notification settings - Fork 464
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 Include(dict) + ToPagedListAsync behavior. Closes GH-3351
- Loading branch information
1 parent
504f036
commit 81b1241
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
src/LinqTests/Bugs/Bug_3351_Include_with_ToPagedListAsync.cs
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,48 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Marten.Pagination; | ||
using Marten.Testing.Harness; | ||
using Shouldly; | ||
|
||
namespace LinqTests.Bugs; | ||
|
||
public class Bug_3351_Include_with_ToPagedListAsync : BugIntegrationContext | ||
{ | ||
[Fact] | ||
public async Task should_work_just_fine() | ||
{ | ||
theSession.Store(new UserInformation3351 | ||
{ | ||
Id = "hansolo", Company = "Acme" | ||
}); | ||
|
||
theSession.Store(new User3351 | ||
{ | ||
Id = "hansolo", FirstName = "Han" | ||
}); | ||
|
||
await theSession.SaveChangesAsync(); | ||
|
||
var userInfo = new Dictionary<string, UserInformation3351>(); | ||
var users = await theSession | ||
.Query<User3351>() | ||
.Include(x => x.Id, userInfo) | ||
.ToPagedListAsync(1, 1); // This does not | ||
|
||
users.Single().Id.ShouldBe("hansolo"); | ||
userInfo["hansolo"].Company.ShouldBe("Acme"); | ||
} | ||
} | ||
|
||
public class User3351 | ||
{ | ||
public string? Id { get; set; } | ||
public string? FirstName { get; set; } | ||
} | ||
|
||
public class UserInformation3351 | ||
{ | ||
public string? Id { get; set; } | ||
public string? Company { get; set; } | ||
} |