From 89ef7aeb883d5b971e040b1e76138deff81fdac2 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Fri, 24 Jun 2022 14:44:34 +0800 Subject: [PATCH] Add unit test --- .../SqlServerTest/SqlServerTest.csproj | 1 + .../SqlServerTest/UnitTest/UCustom024.cs | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Src/Asp.Net/SqlServerTest/UnitTest/UCustom024.cs diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj index 2c7057b24..e8fab764d 100644 --- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj +++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj @@ -96,6 +96,7 @@ + diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom024.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom024.cs new file mode 100644 index 000000000..53094e9e0 --- /dev/null +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom024.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OrmTest +{ + public class UCustom024 + { + public static void Init() + { + var db = NewUnitTest.Db; + var data=db.EntityMaintenance.GetEntityInfoNoCache(typeof(UnitNewP)); + db.CodeFirst.InitTables(); + db.Insertable(new UnitNewP() { Id = Guid.NewGuid() }).ExecuteCommand(); + var list=db.Queryable().Take(2).ToList(); + db.Updateable(list).ExecuteCommand(); + db.Deleteable(list).ExecuteCommand(); + } + + } + + public class UnitNewP: UnitBaseP + { + [SqlSugar.SugarColumn(IsPrimaryKey =true)] + public new Guid Id { get; set; } + [SqlSugar.SugarColumn(IsNullable =true)] + public string Name { get; set; } + } + public class UnitBaseP + { + public int Id { get; set; } + } +}