From 4c38a7a375abe4e2f08b3f0c73eab4b5255ad2eb Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 3 Aug 2022 15:57:24 +0800 Subject: [PATCH] Add unit demo --- .../MySqlTest/UnitTest/UBulkCopy.cs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Src/Asp.NetCore2/MySqlTest/UnitTest/UBulkCopy.cs b/Src/Asp.NetCore2/MySqlTest/UnitTest/UBulkCopy.cs index cd7160a93..5de8e2a01 100644 --- a/Src/Asp.NetCore2/MySqlTest/UnitTest/UBulkCopy.cs +++ b/Src/Asp.NetCore2/MySqlTest/UnitTest/UBulkCopy.cs @@ -128,8 +128,50 @@ namespace OrmTest }); var list4 = Db.Queryable().ToList(); SqlSugar.Check.Exception(list4.First().table==true, "unit error"); + + Db.CodeFirst.InitTables(); + Db.DbMaintenance.TruncateTable(); + Db.Fastest().BulkCopy(new List() { + new unitBools() + { + false1 = true, + null1 = true, + true1 = true, + id = 1 + }}); + var data2xxx = Db.Queryable().First(); + var data2 = Db.Queryable().First(); + if (data2.null1 != true || data2.true1 != true|| data2.false1 != true) + { + throw new Exception("uint error"); + } + Db.Fastest().BulkUpdate(new List() { + new unitBools() + { + false1 = false, + null1 = null, + true1 = true, + id = 1 + }}); + data2 = Db.Queryable() .First(); + if (data2.false1 != false||data2.true1!=true||data2.null1!=null) + { + throw new Exception("uint error"); + } } } + + public class unitBools + { + [SqlSugar.SugarColumn(IsPrimaryKey =true)] + public int id { get; set; } + [SqlSugar.SugarColumn(IsNullable = true,ColumnDataType = "tinyint", Length = 1)] + public bool? false1 { get; set; } + [SqlSugar.SugarColumn(IsNullable = true, ColumnDataType = "tinyint", Length = 1)] + public bool? true1 { get; set; } + [SqlSugar.SugarColumn(IsNullable = true, ColumnDataType = "tinyint", Length = 1)] + public bool? null1 { get; set; } + } public class UnitBulk23131 { [SqlSugar.SugarColumn(IsPrimaryKey = true)]