From 58ee2f8f1c107c672681113e32742f314b7703a7 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 15 May 2024 11:25:41 +0800 Subject: [PATCH] Add unit test --- .../UserTestCases/UnitTest/Main.cs | 1 + .../UserTestCases/UnitTest/Unitadfasda.cs | 53 +++++++++++++++++++ .../UserTestCases/UnitTest/Unitasdfafasyy.cs | 7 +-- 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitadfasda.cs diff --git a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Main.cs b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Main.cs index 682a07971..e391837af 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Main.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Main.cs @@ -33,6 +33,7 @@ namespace OrmTest } public static void Init() { + Unitadfasda.Init(); Unita3affafa.Init(); UnitEnumTest.Init(); Unitadf1yaadfa.Init(); diff --git a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitadfasda.cs b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitadfasda.cs new file mode 100644 index 000000000..6d088ae1b --- /dev/null +++ b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitadfasda.cs @@ -0,0 +1,53 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OrmTest +{ + internal class Unitadfasda + { + public static void Init() + { + var db = NewUnitTest.Db; + db.CodeFirst.InitTables(); + db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings() { IsCorrectErrorSqlParameterName = true }; + var ent = new Tax_Base_EmpSerial { Serial = "202401", 工号 = "1001", 户籍所在地_详细地址 = "湖南长沙" }; + var i = db.Updateable(ent).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); + } + } + /// + /// Tax_Base_EmpSerial + /// + [Serializable] + [SugarTable("tax_base_empserial", "Tax_Base_EmpSerial", IsDisabledDelete = true)] + public partial class Tax_Base_EmpSerial + { + /// + ///Serial + /// + [SugarColumn(ColumnName = "serial", ColumnDescription = "Serial", IsPrimaryKey = true, Length = 20, IsNullable = false)] + public string Serial { get; set; } + + /// + ///工号 + /// + [SugarColumn(ColumnName = "工号", ColumnDescription = "工号", Length = 50, IsNullable = true)] + public string 工号 { get; set; } + + /// + ///户籍所在地(详细地址) + /// + [SugarColumn(ColumnName = "户籍所在地(详细地址)", ColumnDescription = "户籍所在地(详细地址)", Length = 255, IsNullable = true)] + public string 户籍所在地_详细地址 { get; set; } + + /// + ///户籍所在地(详细地址) + /// + [SugarColumn(ColumnName = "户籍所在地(省)", ColumnDescription = "户籍所在地(省)", Length = 255, IsNullable = true)] + public string 户籍所在地_省 { get; set; } + + } +} diff --git a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitasdfafasyy.cs b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitasdfafasyy.cs index 13a205dbe..9a809b408 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitasdfafasyy.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitasdfafasyy.cs @@ -146,12 +146,7 @@ namespace OrmTest throw new Exception("unit error"); } } - - - - Console.WriteLine("用例跑完"); - - Console.ReadKey(); + }