From 56b8cffb46433722aba90a2af99b00305bdbd1b9 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Sun, 21 Nov 2021 13:09:23 +0800 Subject: [PATCH] Update unit test --- .../PgSqlTest/UnitTest/UBulkCopy.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/UnitTest/UBulkCopy.cs b/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/UnitTest/UBulkCopy.cs index c59a41f19..2fd9acbf5 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/UnitTest/UBulkCopy.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/PgSqlTest/UnitTest/UBulkCopy.cs @@ -67,8 +67,36 @@ namespace OrmTest { throw new Exception("unit Bulk"); } + Db.CodeFirst.InitTables(); + Db.DbMaintenance.TruncateTable(); + var count = Db.Fastest().AS("UnitIdentity111").BulkCopy(new List { + new UnitIdentity111111111(){ Id=1, Name="jack" } + }); + if (count == 0) + { + throw new Exception("unit Bulk"); + } + count = Db.Fastest().AS("UnitIdentity111").BulkUpdate(new List { + new UnitIdentity111111111(){ Id=1, Name="jack" } + }); + if (count == 0) + { + throw new Exception("unit Bulk"); + } } } + + public class UnitIdentity111 + { + public int Id { get; set; } + public string Name { get; set; } + } + public class UnitIdentity111111111 + { + [SqlSugar.SugarColumn(IsPrimaryKey = true)] + public int Id { get; set; } + public string Name { get; set; } + } public class UnitIdentity1 { [SqlSugar.SugarColumn(IsPrimaryKey =true)]