mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-08 02:14:53 +08:00
Update unit test
This commit is contained in:
@@ -41,6 +41,20 @@ namespace OrmTest
|
||||
sno = "a",
|
||||
username = "admin"
|
||||
}).ExecuteCommand();
|
||||
db.Insertable(new OperatorInfo()
|
||||
{
|
||||
id = "3",
|
||||
createTime = DateTime.Now,
|
||||
isDel = 1,
|
||||
isDisabled = 1,
|
||||
openid = "",
|
||||
phone = "",
|
||||
pwd = "",
|
||||
realname = "a01",
|
||||
remark = "a",
|
||||
sno = "a",
|
||||
username = "admin"
|
||||
}).ExecuteCommand();
|
||||
var id=db.Insertable(new Role()
|
||||
{
|
||||
id=1,
|
||||
@@ -61,8 +75,17 @@ namespace OrmTest
|
||||
.Includes(x => x.Roles).Where(x => x.Roles.Any(z=>z.id==1))
|
||||
.ToList();
|
||||
var list = db.Queryable<OperatorInfo>()
|
||||
.Includes(x => x.Roles).Where(x => x.Roles.Any())
|
||||
.ToListAsync().GetAwaiter().GetResult();
|
||||
.Includes(x => x.Roles).Where(x=>x.Roles.Any()).ToList();
|
||||
if (list.Count != 2)
|
||||
{
|
||||
throw new Exception("unit error");
|
||||
}
|
||||
var list3 = db.Queryable<OperatorInfo>()
|
||||
.Includes(x => x.Roles).Where(x => x.Roles.Count()==0).ToList();
|
||||
if (list3.Count != 1)
|
||||
{
|
||||
throw new Exception("unit error");
|
||||
}
|
||||
var list2=db.Queryable<OperatorInfo>()
|
||||
.Includes(x => x.Roles.MappingField(z=>z.name,()=>x.username).ToList())
|
||||
.ToList();
|
||||
|
||||
Reference in New Issue
Block a user