From 3e1c03ed62ac7f0d96d8ff7b527f7baecf2210df Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 28 Nov 2022 19:27:31 +0800 Subject: [PATCH] Add unit test --- Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs index 7abd99092..8b317b2c0 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs @@ -95,9 +95,25 @@ namespace OrmTest { throw new Exception("unit error"); } + + db.CodeFirst.InitTables(); + db.DbMaintenance.TruncateTable(); + db.Insertable(new UnitDecmaildfa() { Id = 1, Name = "a" }).ExecuteCommand(); + var x1=db.Storageable(new UnitDecmaildfa() { Id = 1, Name = "a" }).ToStorage(); + if (!x1.UpdateList.Any()) + { + throw new Exception("unit error"); + } + db.DbMaintenance.DropTable(); } + public class UnitDecmaildfa + { + [SqlSugar.SugarColumn(IsPrimaryKey =true)] + public decimal? Id { get; set; } + public string Name { get; set; } + } public static List Search(SqlSugarClient db) where T : ISearch