Add unit.test

This commit is contained in:
sunkaixuan
2022-05-10 13:17:02 +08:00
parent 545bb81900
commit f7dda4401d

View File

@@ -63,6 +63,20 @@ namespace OrmTest
db.Insertable(new UnitJsonTestadsga1() { os = new List<Order>() }).ExecuteCommand();
db.Insertable(new UnitJsonTestadsga1() { os = new List<Order>() { new Order() { CreateTime = DateTime.Now } } }).ExecuteCommand();
var list10 = db.Queryable<UnitJsonTestadsga1>().Select(it => new { it }).ToList();
var jsonDb = Db;
jsonDb.CurrentConnectionConfig.ConfigureExternalServices = new SqlSugar.ConfigureExternalServices()
{
EntityService = (c, p) =>
{
p.IsJson = true;
}
};
var list11 = jsonDb.Queryable<UNITJSONTESTADSGA1>().Select(it => new { it }).ToList();
if (list11.FirstOrDefault().it.os == null)
{
throw new Exception("unit test");
}
}
}
public class UnitJsonTestadsga1
@@ -70,6 +84,11 @@ namespace OrmTest
[SqlSugar.SugarColumn(Length =2000,IsJson =true)]
public List<Order> os{get;set;}
}
public class UNITJSONTESTADSGA1
{
[SqlSugar.SugarColumn(Length = 2000)]
public List<Order> os { get; set; }
}
public class UnitJsonTest2
{
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]