mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Add unit test
This commit is contained in:
parent
b1f294daf7
commit
34ff46c008
@ -154,7 +154,7 @@ namespace OrmTest
|
|||||||
id = 1
|
id = 1
|
||||||
}});
|
}});
|
||||||
data2 = Db.Queryable<unitBools>() .First();
|
data2 = Db.Queryable<unitBools>() .First();
|
||||||
if (data2.false1 != false||data2.true1!=true||data2.null1!=null)
|
if (data2.false1 != false||data2.true1!=true||data2.null1!=false)
|
||||||
{
|
{
|
||||||
throw new Exception("uint error");
|
throw new Exception("uint error");
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using SqlSugar;
|
||||||
namespace OrmTest
|
namespace OrmTest
|
||||||
{
|
{
|
||||||
public partial class NewUnitTest
|
public partial class NewUnitTest
|
||||||
@ -15,6 +15,29 @@ namespace OrmTest
|
|||||||
Db.CodeFirst.InitTables<UnitCodeTest1>();
|
Db.CodeFirst.InitTables<UnitCodeTest1>();
|
||||||
Db.CodeFirst.InitTables<UnitCodeTest111>();
|
Db.CodeFirst.InitTables<UnitCodeTest111>();
|
||||||
Db.CodeFirst.InitTables<UnitIndextest>();
|
Db.CodeFirst.InitTables<UnitIndextest>();
|
||||||
|
|
||||||
|
|
||||||
|
Db.CodeFirst.InitTables(typeof(TestListJson));
|
||||||
|
Db.DbMaintenance.TruncateTable<TestListJson>();
|
||||||
|
Db.Insertable(new TestListJson { Id = 123, NameList = new List<string> { "123abc" } }).ExecuteCommand();
|
||||||
|
var xxx=Db.Queryable<TestListJson>().Where(x => x.Id == 123).Select(x => new TestListJson
|
||||||
|
{
|
||||||
|
Id=x.Id,
|
||||||
|
NameList = x.NameList }).First();
|
||||||
|
if (xxx.NameList == null)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[SugarTable("testjson")]
|
||||||
|
public class TestListJson
|
||||||
|
{
|
||||||
|
[SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(ColumnName = "name_list", IsJson = true, ColumnDataType = "json")]
|
||||||
|
public List<string> NameList { get; set; }
|
||||||
}
|
}
|
||||||
[SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)]
|
[SqlSugar.SugarIndex("UnitIndextestIndex", nameof(UnitIndextest.Table), SqlSugar.OrderByType.Asc)]
|
||||||
public class UnitIndextest
|
public class UnitIndextest
|
||||||
|
Loading…
Reference in New Issue
Block a user