mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-22 20:13:41 +08:00
Add unit.test
This commit is contained in:
@@ -63,6 +63,20 @@ namespace OrmTest
|
|||||||
db.Insertable(new UnitJsonTestadsga1() { os = new List<Order>() }).ExecuteCommand();
|
db.Insertable(new UnitJsonTestadsga1() { os = new List<Order>() }).ExecuteCommand();
|
||||||
db.Insertable(new UnitJsonTestadsga1() { os = new List<Order>() { new Order() { CreateTime = DateTime.Now } } }).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 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
|
public class UnitJsonTestadsga1
|
||||||
@@ -70,6 +84,11 @@ namespace OrmTest
|
|||||||
[SqlSugar.SugarColumn(Length =2000,IsJson =true)]
|
[SqlSugar.SugarColumn(Length =2000,IsJson =true)]
|
||||||
public List<Order> os{get;set;}
|
public List<Order> os{get;set;}
|
||||||
}
|
}
|
||||||
|
public class UNITJSONTESTADSGA1
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(Length = 2000)]
|
||||||
|
public List<Order> os { get; set; }
|
||||||
|
}
|
||||||
public class UnitJsonTest2
|
public class UnitJsonTest2
|
||||||
{
|
{
|
||||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||||
|
Reference in New Issue
Block a user