mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Add unit test
This commit is contained in:
parent
165822aab6
commit
7cc747322b
@ -167,6 +167,32 @@ namespace OrmTest
|
||||
//.Where(it=>it.Child.Any())
|
||||
.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 =>
|
||||
{
|
||||
it.Child = it.Child.OrderBy(x => x.Id).ToList();
|
||||
@ -227,6 +253,11 @@ namespace OrmTest
|
||||
public string name2{ get; set; }
|
||||
public string orgid { get; set; }
|
||||
}
|
||||
public class ViewTree1
|
||||
{
|
||||
public int Count { get; set; }
|
||||
public List<Tree1> Child { get; set; }
|
||||
}
|
||||
public class Tree1
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||
|
Loading…
Reference in New Issue
Block a user