mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-26 02:09:37 +08:00
Add unit tesst
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@@ -66,15 +67,31 @@ namespace OrmTest
|
|||||||
.SetColumns(it => new UnitJsonTestadsga1() { os = order })
|
.SetColumns(it => new UnitJsonTestadsga1() { os = order })
|
||||||
.Where(it => true)
|
.Where(it => true)
|
||||||
.ExecuteCommand();
|
.ExecuteCommand();
|
||||||
var list14 = db.Queryable<UnitJsonTestadsga1>().ToList();
|
|
||||||
|
db.CodeFirst.InitTables<Unitaaar2>();
|
||||||
|
db.Insertable(new Unitaaar2() { arr = new string[] { "a", "c" } }).ExecuteCommand();
|
||||||
|
var list14 = db.Queryable<Unitaaar2>()
|
||||||
|
.Select(it=>new {
|
||||||
|
x=SqlFunc.JsonIndex(it.arr, 0),
|
||||||
|
x2 = SqlFunc.JsonIndex(it.arr, 1)
|
||||||
|
}).ToList();
|
||||||
|
if (list14.First().x != "a"&& list14.Last().x != "c")
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class Unitaaar2
|
||||||
|
{
|
||||||
|
[SugarColumn(IsJson = true, IsNullable = true)]
|
||||||
|
public string[] arr { get; set; }
|
||||||
|
}
|
||||||
public class UnitJsonTestadsga1
|
public class UnitJsonTestadsga1
|
||||||
{
|
{
|
||||||
[SqlSugar.SugarColumn( IsJson = true)]
|
[SqlSugar.SugarColumn( IsJson = true)]
|
||||||
public List<Order> os { get; set; }
|
public List<Order> os { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Unitaaar
|
public class Unitaaar
|
||||||
{
|
{
|
||||||
[SugarColumn(ColumnDataType = "text []", IsArray = true, IsNullable = true)]
|
[SugarColumn(ColumnDataType = "text []", IsArray = true, IsNullable = true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user