Add unit test

This commit is contained in:
sunkaixuan 2023-06-11 12:35:05 +08:00
parent 9d873846bc
commit b17d01b7cc
3 changed files with 27 additions and 0 deletions

View File

@ -202,6 +202,7 @@
<Compile Include="UnitTest\UOneManyMany2.cs" />
<Compile Include="UnitTest\UOneManyMany.cs" />
<Compile Include="UnitTest\UOneManyMany7.cs" />
<Compile Include="UnitTest\UQueryableByObject.cs" />
<Compile Include="UnitTest\USelectSinleDTO.cs" />
<Compile Include="UnitTest\USelectTest.cs" />
<Compile Include="UnitTest\USplit.cs" />

View File

@ -31,6 +31,7 @@ namespace OrmTest
}
public static void Init()
{
UQueryableByObject.Init();
Unit23131.Init();
SplitTest2();
UOneManyMany7.init();

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class UQueryableByObject
{
public static void Init()
{
var db = NewUnitTest.Db;
var type = typeof(Order);
var data=db.QueryableByObject(type)
.Where("id=1").ToList();
var data2=db.QueryableByObject(type)
.Where("id=@id",new {id=1 }).ToList();
var data3 = db.QueryableByObject(type)
.OrderBy("id").Where("id=@id", new { id = 1 }).ToList();
var data4 = db.QueryableByObject(type)
.GroupBy("id").Having("count(name)>0").Select("Id").ToList();
}
}
}