Update unit test

This commit is contained in:
sunkaixuan 2023-06-29 13:51:32 +08:00
parent 61ac948bae
commit 763b89de45

View File

@ -79,7 +79,7 @@ namespace OrmTest
var sql = db.QueryableWithAttr<KingJsonTest>().LeftJoin<KingTree>((t, j) => t.Id == j.Id).ToSqlString(); var sql = db.QueryableWithAttr<KingJsonTest>().LeftJoin<KingTree>((t, j) => t.Id == j.Id).ToSqlString();
if (!sql.Contains("\"KINGTREE\"")) if (!sql.Contains("\"KINGTREE\""))
{ {
throw new Exception("unit error"); throw new Exception("unit error");
@ -88,6 +88,22 @@ namespace OrmTest
{ {
throw new Exception("unit error"); throw new Exception("unit error");
} }
var sq2 = db.QueryableWithAttr<KingJsonTest>()
.LeftJoin<KingTree>((t, j) => t.Id == j.Id)
.Where((t, j) => t.CreateTime == null || j.ParentId == 1)
.Select((t, j) => new KingOutPut() { }, true)
.ToSqlString();
var sql3 = "SELECT \"T\".\"CREATE_TIME\" AS \"CREATETIME\" ,\"J\".\"PARENTID\" AS \"PARENTID\" FROM \"KING_JSON_TEST\" \"T\" Left JOIN HGT.\"KINGTREE\" \"J\" ON ( \"T\".\"ID\" = \"J\".\"ID\" ) WHERE (( \"T\".\"CREATE_TIME\" IS NULL ) OR ( \"J\".\"PARENTID\" = 1 ))";
if (sq2 != sql3)
{
throw new Exception("unit error");
}
}
public class KingOutPut
{
public DateTime CreateTime { get; set; }
public int ParentId { get; set; }
} }
//Json字段实体 //Json字段实体