mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-21 02:58:05 +08:00
Add unit test
This commit is contained in:
@@ -167,6 +167,32 @@ namespace OrmTest
|
|||||||
//.Where(it=>it.Child.Any())
|
//.Where(it=>it.Child.Any())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
|
||||||
|
var xxx2 = db.Queryable<Tree1>()
|
||||||
|
.Includes(it => it.Child)
|
||||||
|
.GroupBy(x=>x.Id)
|
||||||
|
.OrderByDescending(x=>x.Id)
|
||||||
|
.ToList(it => new ViewTree1{
|
||||||
|
Count=SqlFunc.AggregateMin(it.Id)
|
||||||
|
});
|
||||||
|
if (xxx2.Last().Child == null)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx23 = db.Queryable<Tree1>()
|
||||||
|
.Includes(it => it.Child)
|
||||||
|
.GroupBy(x => x.Id)
|
||||||
|
.OrderByDescending(x => x.Id)
|
||||||
|
.ToListAsync(it => new ViewTree1
|
||||||
|
{
|
||||||
|
Count = SqlFunc.AggregateMin(it.Id)
|
||||||
|
}).GetAwaiter().GetResult();
|
||||||
|
if (xxx23.Last().Child == null)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
|
||||||
db.ThenMapper(xxx, it =>
|
db.ThenMapper(xxx, it =>
|
||||||
{
|
{
|
||||||
it.Child = it.Child.OrderBy(x => x.Id).ToList();
|
it.Child = it.Child.OrderBy(x => x.Id).ToList();
|
||||||
@@ -227,6 +253,11 @@ namespace OrmTest
|
|||||||
public string name2{ get; set; }
|
public string name2{ get; set; }
|
||||||
public string orgid { get; set; }
|
public string orgid { get; set; }
|
||||||
}
|
}
|
||||||
|
public class ViewTree1
|
||||||
|
{
|
||||||
|
public int Count { get; set; }
|
||||||
|
public List<Tree1> Child { get; set; }
|
||||||
|
}
|
||||||
public class Tree1
|
public class Tree1
|
||||||
{
|
{
|
||||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||||
|
Reference in New Issue
Block a user