Add unit test

This commit is contained in:
sunkaixuan
2023-01-29 16:09:37 +08:00
parent f7ec6703e7
commit 3f77866b21
3 changed files with 38 additions and 0 deletions

View File

@@ -99,6 +99,7 @@
<Compile Include="Models\ViewOrder.cs" />
<Compile Include="UnitTest\UInsert3.cs" />
<Compile Include="UnitTest\Unitadfa1231.cs" />
<Compile Include="UnitTest\UnitFilterasdfas.cs" />
<Compile Include="UnitTest\UnitSubToList.cs" />
<Compile Include="UnitTest\Models\EntityBase.cs" />
<Compile Include="UnitTest\UnitByteArray.cs" />

View File

@@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
UnitFilterasdfas.Init();
Unitadfa1231.Init();
UInsert3.Init();
USelectTest.Init();

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class UnitFilterasdfas
{
public static void Init()
{
var db = NewUnitTest.Db;
db.CodeFirst.InitTables<UnitOrderA01, UnitOrderB02>();
db.QueryFilter.AddTableFilter<IDeleted>(it => it.IsDeleted == false);
var list = db.Queryable<UnitOrderA01>()
.LeftJoin<UnitOrderB02>((x, t) => x.ID == t.ID)
.LeftJoin<UnitOrderB02>((x, t,t2) => x.ID == t2.ID)
.ToList();
}
public interface IDeleted
{
bool IsDeleted { get; set; }
}
public class UnitOrderA01 : IDeleted
{
public int ID { get; set; }
public bool IsDeleted { get; set; }
}
public class UnitOrderB02 : IDeleted
{
public int ID { get; set; }
public bool IsDeleted { get; set; }
}
}
}