From e9a469baad5c314f84b205544df33b813b2a7ccb Mon Sep 17 00:00:00 2001
From: sunkaixuan <610262374@qq.com>
Date: Fri, 13 May 2022 20:36:37 +0800
Subject: [PATCH] Add unit test
---
.../SqlServerTest/SqlServerTest.csproj | 1 +
Src/Asp.Net/SqlServerTest/UnitTest/Main.cs | 1 +
.../SqlServerTest/UnitTest/UByteArray.cs | 42 +++++++++++++++++++
3 files changed, 44 insertions(+)
create mode 100644 Src/Asp.Net/SqlServerTest/UnitTest/UByteArray.cs
diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
index 3c30b6dde..9605a4a27 100644
--- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
+++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
@@ -95,6 +95,7 @@
+
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
index 7952a8d84..6505094ed 100644
--- a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
@@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
+ UByteArray.Init();
UCustom020.Init();
UCustom019.Init();
UnitManyToMany.Init();
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UByteArray.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UByteArray.cs
new file mode 100644
index 000000000..cf5ef0da5
--- /dev/null
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/UByteArray.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OrmTest
+{
+ public class UByteArray
+ {
+ public static void Init()
+ {
+ var db = NewUnitTest.Db;
+ db.CodeFirst.InitTables();
+ db.DbMaintenance.TruncateTable();
+ db.Insertable(new UnitBytePk()
+ {
+ id=new byte[] { 1,2,3},
+ name="a"
+ }).ExecuteCommand();
+ db.Insertable(new UnitBytePk()
+ {
+ id = new byte[] { 2, 2, 3 },
+ name = "a2"
+ }).ExecuteCommand();
+ var x=db.Storageable(new UnitBytePk()
+ {
+ id =new byte []{ 1, 2, 3 },
+ name = "aaa"
+ }).ToStorage();
+ var count=x.AsUpdateable.ExecuteCommand();
+ SqlSugar.Check.Exception(count == 3, "unit error");
+
+ }
+ public class UnitBytePk
+ {
+ [SqlSugar.SugarColumn(IsPrimaryKey =true,ColumnDataType ="binary(20)")]
+ public byte[] id { get; set; }
+ public string name { get; set; }
+ }
+ }
+}