From 14d80ec9e80fddba24df0e6dc8b9645911c1f1f6 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 23 Sep 2023 18:44:09 +0800 Subject: [PATCH] Add unit test --- Src/Asp.Net/PgSqlTest/PgSqlTest.csproj | 1 + Src/Asp.Net/PgSqlTest/UnitTest/Main.cs | 1 + .../PgSqlTest/UnitTest/Unitadfafafasd.cs | 133 ++++++++++++++++++ Src/Asp.NetCore2/PgSqlTest/UnitTest/Main.cs | 1 + .../PgSqlTest/UnitTest/Unitadfafafasd.cs | 132 +++++++++++++++++ 5 files changed, 268 insertions(+) create mode 100644 Src/Asp.Net/PgSqlTest/UnitTest/Unitadfafafasd.cs create mode 100644 Src/Asp.NetCore2/PgSqlTest/UnitTest/Unitadfafafasd.cs diff --git a/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj b/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj index c7b048c14..bbff6ff8a 100644 --- a/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj +++ b/Src/Asp.Net/PgSqlTest/PgSqlTest.csproj @@ -114,6 +114,7 @@ + diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs b/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs index 3e1626c1d..ba50ec90f 100644 --- a/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs +++ b/Src/Asp.Net/PgSqlTest/UnitTest/Main.cs @@ -31,6 +31,7 @@ namespace OrmTest } public static void Init() { + Unitadfafafasd.Init(); UintOneToOneDto.Init(); Unitadfaafsd.Init(); CrossDatabase02.Init(); diff --git a/Src/Asp.Net/PgSqlTest/UnitTest/Unitadfafafasd.cs b/Src/Asp.Net/PgSqlTest/UnitTest/Unitadfafafasd.cs new file mode 100644 index 000000000..95f6d9eaa --- /dev/null +++ b/Src/Asp.Net/PgSqlTest/UnitTest/Unitadfafafasd.cs @@ -0,0 +1,133 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OrmTest +{ + internal class Unitadfafafasd + { + public static void Init() + { + var db = NewUnitTest.Db; + db.CodeFirst.InitTables(); + event_handle_task model = new event_handle_task(); + db.CodeFirst.InitTables(); + var p = model.data_source_type; + + var xxx2 = db.Updateable().SetColumns(u => new event_handle_task + { + data_source_type = p ?? 20, + }) + .Where(c => c.id == 454206551670915072) + .ToSql(); + var xx= UtilMethods.GetNativeSql(xxx2.Key, xxx2.Value.ToArray()); + } + /// + ///event_handle_task + /// + [Serializable] + public partial class event_handle_task + { + #region Model + private long _id; + private int _event_type; + private int? _data_source_type; + private string _data_source_id; + private string _data_source_content; + private int? _opt_count = 0; + private int _serial_flag = 0; + private DateTime? _create_date = DateTime.Now; + private DateTime? _update_date = DateTime.Now; + + /// + /// + /// + [SqlSugar.SugarColumn(IsPrimaryKey = true)] + public long id + { + set { _id = value; } + get { return _id; } + } + /// + /// + /// + + public int event_type + { + set { _event_type = value; } + get { return _event_type; } + } + /// + /// + /// + + public int? data_source_type + { + set { _data_source_type = value; } + get { return _data_source_type; } + } + /// + /// + /// + + public string data_source_id + { + set { _data_source_id = value; } + get { return _data_source_id; } + } + /// + /// + /// + + public string data_source_content + { + set { _data_source_content = value; } + get { return _data_source_content; } + } + /// + /// + /// + + public int? opt_count + { + set { _opt_count = value; } + get { return _opt_count; } + } + /// + /// + /// + + public int serial_flag + { + set { _serial_flag = value; } + get { return _serial_flag; } + } + + /// + /// + /// + + public DateTime? create_date + { + set { _create_date = value; } + get { return _create_date; } + } + /// + /// + /// + + public DateTime? update_date + { + set { _update_date = value; } + get { return _update_date; } + } + + #endregion Model + + + } + } +} diff --git a/Src/Asp.NetCore2/PgSqlTest/UnitTest/Main.cs b/Src/Asp.NetCore2/PgSqlTest/UnitTest/Main.cs index d82712f49..ea27df066 100644 --- a/Src/Asp.NetCore2/PgSqlTest/UnitTest/Main.cs +++ b/Src/Asp.NetCore2/PgSqlTest/UnitTest/Main.cs @@ -31,6 +31,7 @@ namespace OrmTest } public static void Init() { + Unitadfafafasd.Init(); UnitSubToList.Init(); Unit001.Init(); Bulk(); diff --git a/Src/Asp.NetCore2/PgSqlTest/UnitTest/Unitadfafafasd.cs b/Src/Asp.NetCore2/PgSqlTest/UnitTest/Unitadfafafasd.cs new file mode 100644 index 000000000..deb3398e5 --- /dev/null +++ b/Src/Asp.NetCore2/PgSqlTest/UnitTest/Unitadfafafasd.cs @@ -0,0 +1,132 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OrmTest +{ + internal class Unitadfafafasd + { + public static void Init() + { + var db = NewUnitTest.Db; + db.CodeFirst.InitTables(); + event_handle_task model = new event_handle_task(); + db.CodeFirst.InitTables(); + var p = model.data_source_type; + + var xxx2 = db.Updateable().SetColumns(u => new event_handle_task + { + data_source_type = p ?? 20, + }) + .Where(c => c.id == 454206551670915072) + .ExecuteCommand(); + } + /// + ///event_handle_task + /// + [Serializable] + public partial class event_handle_task + { + #region Model + private long _id; + private int _event_type; + private int? _data_source_type; + private string _data_source_id; + private string _data_source_content; + private int? _opt_count = 0; + private int _serial_flag = 0; + private DateTime? _create_date = DateTime.Now; + private DateTime? _update_date = DateTime.Now; + + /// + /// + /// + [SqlSugar.SugarColumn(IsPrimaryKey = true)] + public long id + { + set { _id = value; } + get { return _id; } + } + /// + /// + /// + + public int event_type + { + set { _event_type = value; } + get { return _event_type; } + } + /// + /// + /// + + public int? data_source_type + { + set { _data_source_type = value; } + get { return _data_source_type; } + } + /// + /// + /// + + public string data_source_id + { + set { _data_source_id = value; } + get { return _data_source_id; } + } + /// + /// + /// + + public string data_source_content + { + set { _data_source_content = value; } + get { return _data_source_content; } + } + /// + /// + /// + + public int? opt_count + { + set { _opt_count = value; } + get { return _opt_count; } + } + /// + /// + /// + + public int serial_flag + { + set { _serial_flag = value; } + get { return _serial_flag; } + } + + /// + /// + /// + + public DateTime? create_date + { + set { _create_date = value; } + get { return _create_date; } + } + /// + /// + /// + + public DateTime? update_date + { + set { _update_date = value; } + get { return _update_date; } + } + + #endregion Model + + + } + } +}