mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Add unit test
This commit is contained in:
parent
b196b53d8b
commit
e9a469baad
@ -95,6 +95,7 @@
|
|||||||
<Compile Include="Models\OrderItem.cs" />
|
<Compile Include="Models\OrderItem.cs" />
|
||||||
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
|
<Compile Include="Demo\Demo0_SqlSugarClient.cs" />
|
||||||
<Compile Include="Models\ViewOrder.cs" />
|
<Compile Include="Models\ViewOrder.cs" />
|
||||||
|
<Compile Include="UnitTest\UByteArray.cs" />
|
||||||
<Compile Include="UnitTest\UIncludesBigData.cs" />
|
<Compile Include="UnitTest\UIncludesBigData.cs" />
|
||||||
<Compile Include="UnitTest\UCustom020.cs" />
|
<Compile Include="UnitTest\UCustom020.cs" />
|
||||||
<Compile Include="UnitTest\UCustom019.cs" />
|
<Compile Include="UnitTest\UCustom019.cs" />
|
||||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UByteArray.Init();
|
||||||
UCustom020.Init();
|
UCustom020.Init();
|
||||||
UCustom019.Init();
|
UCustom019.Init();
|
||||||
UnitManyToMany.Init();
|
UnitManyToMany.Init();
|
||||||
|
42
Src/Asp.Net/SqlServerTest/UnitTest/UByteArray.cs
Normal file
42
Src/Asp.Net/SqlServerTest/UnitTest/UByteArray.cs
Normal file
@ -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<UnitBytePk>();
|
||||||
|
db.DbMaintenance.TruncateTable<UnitBytePk>();
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user