mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-05 17:37:58 +08:00
Add unit test
This commit is contained in:
parent
2dbb7a4f2a
commit
08e4fad7ee
@ -78,6 +78,7 @@
|
||||
<Compile Include="Models\Tree.cs" />
|
||||
<Compile Include="Models\ViewOrder.cs" />
|
||||
<Compile Include="UnitTest\Unit01.cs" />
|
||||
<Compile Include="UnitTest\UnitByteArray.cs" />
|
||||
<Compile Include="UnitTest\UnitNavInsertadfa1.cs" />
|
||||
<Compile Include="UnitTest\UnitNavInsertIssue.cs" />
|
||||
<Compile Include="UnitTest\UnitInsertNavN.cs" />
|
||||
|
@ -31,6 +31,7 @@ namespace OrmTest
|
||||
}
|
||||
public static void Init()
|
||||
{
|
||||
UnitByteArray.Init();
|
||||
Unit01.Init();
|
||||
UnitNavInsertadfa1.Init();
|
||||
UnitNavInsertIssue.Init();
|
||||
|
40
Src/Asp.Net/SqliteTest/UnitTest/UnitByteArray.cs
Normal file
40
Src/Asp.Net/SqliteTest/UnitTest/UnitByteArray.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OrmTest
|
||||
{
|
||||
public class UnitByteArray
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
var db = NewUnitTest.Db;
|
||||
var b=new byte[1024];
|
||||
b[0] = 1;
|
||||
b[1] = 2;
|
||||
b[1023] = 2;
|
||||
if (db.DbMaintenance.IsAnyTable("UnitBytes001231",false))
|
||||
{
|
||||
db.DbMaintenance.DropTable<UnitBytes001231>();
|
||||
}
|
||||
db.CodeFirst.InitTables<UnitBytes001231>();
|
||||
db.DbMaintenance.TruncateTable<UnitBytes001231>();
|
||||
db.Insertable(new UnitBytes001231() { array = b }).ExecuteCommand();
|
||||
var list4 = db.Queryable<UnitBytes001231>().First().array;
|
||||
var old = string.Join(",", b);
|
||||
var newstr = string.Join(",", list4);
|
||||
if (old != newstr)
|
||||
{
|
||||
throw new Exception("unit error");
|
||||
}
|
||||
Console.WriteLine("#### CodeFirst end ####");
|
||||
}
|
||||
}
|
||||
public class UnitBytes001231
|
||||
{
|
||||
public byte[] array { get; set; }
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user