From 7cc747322b5ca69b571c64d92ce527140d404016 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 14 Jul 2022 19:20:09 +0800 Subject: [PATCH] Add unit test --- .../SqlServerTest/UnitTest/UCustom012.cs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs index 754e7d780..93e32c894 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs @@ -167,6 +167,32 @@ namespace OrmTest //.Where(it=>it.Child.Any()) .ToList(); + + var xxx2 = db.Queryable() + .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() + .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 Child { get; set; } + } public class Tree1 { [SqlSugar.SugarColumn(IsPrimaryKey = true)]