Skip to content

Commit

Permalink
Test to verify Include(dict) + ToPagedListAsync behavior. Closes GH-3351
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Aug 4, 2024
1 parent 504f036 commit 81b1241
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/LinqTests/Bugs/Bug_3351_Include_with_ToPagedListAsync.cs
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; }
}

0 comments on commit 81b1241

Please sign in to comment.