Add unit test

This commit is contained in:
sunkaixuan 2022-08-16 18:12:57 +08:00
parent b1f294daf7
commit 34ff46c008
2 changed files with 25 additions and 2 deletions

View File

@ -154,7 +154,7 @@ namespace OrmTest
id = 1
}});
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");
}

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
namespace OrmTest
{
public partial class NewUnitTest
@ -15,6 +15,29 @@ namespace OrmTest
Db.CodeFirst.InitTables<UnitCodeTest1>();
Db.CodeFirst.InitTables<UnitCodeTest111>();
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)]
public class UnitIndextest