Add unit test

This commit is contained in:
sunkaixuan 2023-04-30 15:34:50 +08:00
parent 35e9634419
commit 18b364a737

View File

@ -4,6 +4,7 @@ using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
@ -31,13 +32,23 @@ namespace OrmTest
db.Insertable(new OrderItem() { ItemId = 3, OrderId =3, Price=3}).ExecuteCommand();
db.Insertable(new OrderItem() { ItemId = 4, OrderId=4 , Price=4}).ExecuteCommand();
TestGetAll(db);
TestAutoDto(db);
TestWhere(db);
TestJoin(db);
TestJoin2(db);
TestJoin3(db);
TestJoin4(db);
}
private static void TestAutoDto(SqlSugarClient db)
{
Expression xx = null;
var test1 = db.Queryable<Order>().Select(it => new myDTO
{
Id = it.Id,
disCount = SqlFunc.Subqueryable<Order>().Where(s=>s.Id==it.Id).ToList(s=>new Order() { } ,true)
})
.ToList();
}
private static void TestJoin4(SqlSugarClient db)
{
var test1 = db.Queryable<Order>()