-
Notifications
You must be signed in to change notification settings - Fork 453
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
194b4e8
commit 0fe4d58
Showing
1 changed file
with
66 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,66 @@ | ||
using System.Linq; | ||
using FluentAssertions; | ||
using LinqToDB; | ||
using LinqToDB.Mapping; | ||
using NUnit.Framework; | ||
using System.Linq.Dynamic.Core; | ||
using System.Linq.Dynamic.Core.CustomTypeProviders; | ||
using System.Collections.Generic; | ||
using System; | ||
|
||
namespace Tests.UserTests | ||
{ | ||
[TestFixture] | ||
public class Issue4390Tests : TestBase | ||
{ | ||
[Table] | ||
public class InfeedAdviceDTO | ||
{ | ||
[Column] public int Id { get; set; } | ||
} | ||
|
||
[Table] | ||
public class InventoryResourceDTO | ||
{ | ||
[Column] public int InfeedAdviceID { get; set; } | ||
} | ||
public class MlogCombined1 | ||
{ | ||
public InfeedAdviceDTO? InfeedAdvice { get; set; } | ||
|
||
public int? Count { get; set; } | ||
} | ||
|
||
public class MlogCombined2 | ||
{ | ||
public MlogCombined1? MlogCombined1 { get; set; } | ||
} | ||
|
||
[Test] | ||
public void Issue4390Test([IncludeDataSources(TestProvName.AllSQLite)] string context) | ||
{ | ||
using (var db = GetDataContext(context)) | ||
using (db.CreateLocalTable<InfeedAdviceDTO>()) | ||
using (db.CreateLocalTable<InventoryResourceDTO>()) | ||
{ | ||
db.Insert(new InventoryResourceDTO() { InfeedAdviceID = 1 }); | ||
db.Insert(new InfeedAdviceDTO() { Id = 1 }); | ||
|
||
var irs = from ir in db.GetTable<InventoryResourceDTO>() select ir; | ||
|
||
var qry = from infeed in db.GetTable<InfeedAdviceDTO>() | ||
join inventory in db.GetTable<InventoryResourceDTO>() on infeed.Id equals inventory.InfeedAdviceID | ||
select new MlogCombined2 | ||
{ | ||
MlogCombined1 = new MlogCombined1 | ||
{ | ||
InfeedAdvice = infeed, | ||
Count = irs.Count(x => x.InfeedAdviceID == infeed.Id), | ||
} | ||
}; | ||
|
||
var l = qry.Where(x => x.MlogCombined1 != null).Count(); | ||
} | ||
} | ||
} | ||
} |