Add unit test

This commit is contained in:
sunkaixuan 2023-01-15 19:59:41 +08:00
parent bdc0170f31
commit b94134bee3

View File

@ -57,7 +57,29 @@ namespace OrmTest
{
throw new Exception("unit test");
}
db.CodeFirst.InitTables<OrderMain11, OrderAarray11>();
var id=db.Insertable(new OrderMain11() { Name = "a" }).ExecuteReturnIdentity();
db.Insertable(new OrderAarray11() { fk=id, Json = new int[] { 1} }).ExecuteCommand();
var list31 = db.Queryable<OrderAarray11>().ToList();
var list3=db.Queryable<OrderMain11>().LeftJoin<OrderAarray11>((t1, ti2) => t1.Id == ti2.fk)
.Select((t1, ti2) => new { t1.Id, t1.Name,json= ti2.Json }).ToList();
}
public class OrderMain11
{
[SugarColumn(IsPrimaryKey = true,IsIdentity =true)]
public int Id { get; set; }
public string Name { get; set; }
}
public class OrderAarray11
{
[SugarColumn(IsPrimaryKey =true, IsIdentity = true)]
public int Id { get; set; }
public int fk { get; set; }
[SugarColumn(IsJson =true)]
public int[] Json { get; set; }
}
public class UnitJsonArray
{