From 87c4bf46c567dd140d693d95e7cf8ec782689eb3 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 27 Sep 2022 21:47:29 +0800 Subject: [PATCH] Add unit test --- .../SqlServerTest/UnitTest/UCustom20.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom20.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom20.cs index cb63b9fa1..c7c46d112 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom20.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom20.cs @@ -88,6 +88,25 @@ namespace OrmTest { throw new Exception("unit error"); } + var list = db.Queryable().ToList(); + var test7 = db.Queryable() + .LeftJoin((x,y)=>x.Id==y.Id) + .Take(2) + .Select((x,y) => new TestDTO + { + SubOne = new TestSubDTO { NameOne = x.Name, NameTwo = x.Name }, + SubTwo = new TestSubDTO { NameOne = x.Name, NameTwo = x.Name } + }) + .ToList() ; + + if (test7.First().SubTwo.NameTwo != "jack"|| test7.First().SubTwo.NameOne != "jack") + { + throw new Exception("unit error"); + } + if (test7.First().SubOne.NameTwo != "jack" || test7.First().SubOne.NameOne != "jack") + { + throw new Exception("unit error"); + } } public class TestDTO