From 47a6ed54b1cd1a0611ee3d0d8edfcf4fdbcf1d59 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Wed, 7 Sep 2022 12:37:51 +0800 Subject: [PATCH] Addd unit test --- .../SqliteTest/UnitTest/UBulkCopy.cs | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqliteTest/UnitTest/UBulkCopy.cs b/Src/Asp.NetCore2/SqliteTest/UnitTest/UBulkCopy.cs index a43ce7127..411ac49bf 100644 --- a/Src/Asp.NetCore2/SqliteTest/UnitTest/UBulkCopy.cs +++ b/Src/Asp.NetCore2/SqliteTest/UnitTest/UBulkCopy.cs @@ -150,10 +150,29 @@ namespace OrmTest { throw new Exception("unit error"); } - Console.WriteLine("用例跑完"); + db.CodeFirst.InitTables(); + db.DbMaintenance.TruncateTable(); + db.Insertable(new UnitBool01() { Bool = true }).ExecuteCommand(); + db.Insertable(new UnitBool01() { Bool = false }).ExecuteCommand(); + db.Fastest().BulkCopy(new List() { new UnitBool01() { Bool = true } }); + db.Fastest().BulkCopy(new List() { new UnitBool01() { Bool = false } }); + var list7=db.Queryable().ToList(); + var list8= db.Queryable().ToDataTable(); + var json=db.Utilities.SerializeObject( db.Utilities.DataTableToDictionaryList(list8)); + if (json != "[{\"Bool\":1},{\"Bool\":0},{\"Bool\":1},{\"Bool\":0}]") + { + throw new Exception("unit error"); + } + Console.WriteLine("用例跑完"); } } + + public class UnitBool01 + { + public bool Bool { get; set; } + } + public class UnitTestoffset11 { [SqlSugar.SugarColumn(IsNullable = true)]