Add unit test

This commit is contained in:
sunkaixuan 2023-09-10 00:56:14 +08:00
parent 649990cde8
commit 1105e25eff
3 changed files with 31 additions and 0 deletions

View File

@ -96,6 +96,7 @@
<Compile Include="UnitTest\UInsert3.cs" />
<Compile Include="UnitTest\Unit01.cs" />
<Compile Include="UnitTest\UnitByteArray.cs" />
<Compile Include="UnitTest\UnitFilterUpdate.cs" />
<Compile Include="UnitTest\UnitNavInsertadfa1.cs" />
<Compile Include="UnitTest\UnitNavInsertIssue.cs" />
<Compile Include="UnitTest\UnitInsertNavN.cs" />

View File

@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
UnitFilterUpdate.Init();
USelectDTO.Init();
UnitNavOneToManyDTO.Init();
Unitadfaafsd.Init();

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class UnitFilterUpdate
{
public static void Init()
{
var db = NewUnitTest.Db;
var updateObj = new Order() { Id = 1, Name = "a", CustomId = 1, CreateTime = DateTime.Now };
db.QueryFilter.AddTableFilter<Order>(x => x.Name == "a");
db.Updateable(updateObj)
.PageSize(1)//需要一条一条更新才能用过滤器
.EnableQueryFilter().ExecuteCommandAsync().GetAwaiter().GetResult();//不支持全局设置需要手动处理
db.QueryFilter.Clear();
db.Updateable(updateObj)
.PageSize(1)//需要一条一条更新才能用过滤器
.EnableQueryFilter().ExecuteCommandAsync().GetAwaiter().GetResult();//不支持全局设置需要手动处理
}
}
}