From 4b811d5d8eceb40a0222d5174f745fb6d8658bcf Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 27 Dec 2022 19:52:15 +0800 Subject: [PATCH] Add unit test --- .../SqlServerTest/UnitTest/UQueryable2.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UQueryable2.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UQueryable2.cs index 56280f62b..138efcdad 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UQueryable2.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UQueryable2.cs @@ -310,8 +310,40 @@ namespace OrmTest { throw new Exception("unit error"); } + db.CodeFirst.InitTables(); + db.Insertable(new UnitPeople() + { + Name="a", + EntryDate=DateTime.Now, + Work="1", + Company="a" + + }).ExecuteCommand(); + var list10=db.Queryable().Select(a => new UnitPeople + { + Name = a.Name, + Job = new JobClass { Company = a.Company, Work = a.Work }, + + EntryDate = a.EntryDate + + } ).ToList(); + } + public class UnitPeople + { + public string Name { get; set; } + [SugarColumn(IsIgnore =true)] + public JobClass Job { get; set; } + + public DateTime? EntryDate { get; set; } + public string Company { get; set; } + public string Work { get; set; } } + public class JobClass + { + public string Company { get; set; } + public string Work { get; set; } + } public class UintAinstringHAHA { [SugarColumn(IsPrimaryKey =true,SqlParameterDbType =System.Data.DbType.AnsiString)]