Skip to content

Commit 0fe4d58

Browse files
committed
test for issue #4390
1 parent 194b4e8 commit 0fe4d58

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System.Linq;
2+
using FluentAssertions;
3+
using LinqToDB;
4+
using LinqToDB.Mapping;
5+
using NUnit.Framework;
6+
using System.Linq.Dynamic.Core;
7+
using System.Linq.Dynamic.Core.CustomTypeProviders;
8+
using System.Collections.Generic;
9+
using System;
10+
11+
namespace Tests.UserTests
12+
{
13+
[TestFixture]
14+
public class Issue4390Tests : TestBase
15+
{
16+
[Table]
17+
public class InfeedAdviceDTO
18+
{
19+
[Column] public int Id { get; set; }
20+
}
21+
22+
[Table]
23+
public class InventoryResourceDTO
24+
{
25+
[Column] public int InfeedAdviceID { get; set; }
26+
}
27+
public class MlogCombined1
28+
{
29+
public InfeedAdviceDTO? InfeedAdvice { get; set; }
30+
31+
public int? Count { get; set; }
32+
}
33+
34+
public class MlogCombined2
35+
{
36+
public MlogCombined1? MlogCombined1 { get; set; }
37+
}
38+
39+
[Test]
40+
public void Issue4390Test([IncludeDataSources(TestProvName.AllSQLite)] string context)
41+
{
42+
using (var db = GetDataContext(context))
43+
using (db.CreateLocalTable<InfeedAdviceDTO>())
44+
using (db.CreateLocalTable<InventoryResourceDTO>())
45+
{
46+
db.Insert(new InventoryResourceDTO() { InfeedAdviceID = 1 });
47+
db.Insert(new InfeedAdviceDTO() { Id = 1 });
48+
49+
var irs = from ir in db.GetTable<InventoryResourceDTO>() select ir;
50+
51+
var qry = from infeed in db.GetTable<InfeedAdviceDTO>()
52+
join inventory in db.GetTable<InventoryResourceDTO>() on infeed.Id equals inventory.InfeedAdviceID
53+
select new MlogCombined2
54+
{
55+
MlogCombined1 = new MlogCombined1
56+
{
57+
InfeedAdvice = infeed,
58+
Count = irs.Count(x => x.InfeedAdviceID == infeed.Id),
59+
}
60+
};
61+
62+
var l = qry.Where(x => x.MlogCombined1 != null).Count();
63+
}
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)