mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Add unit test
This commit is contained in:
parent
60e630c4f2
commit
e74544f5d9
@ -15,29 +15,65 @@ namespace OrmTest
|
||||
var db = NewUnitTest.Db;
|
||||
db.CodeFirst.InitTables<Unitasfa1sadfa>();
|
||||
var list = db.Queryable<Unitasfa1sadfa>()
|
||||
.Select(x => new { x = Convert.ToBoolean(x.ItemId),
|
||||
.Select(x => new
|
||||
{
|
||||
x = Convert.ToBoolean(x.ItemId),
|
||||
x1 = SqlFunc.ToBool(x.ItemId)
|
||||
})
|
||||
.ToList();
|
||||
db.CodeFirst.InitTables<UnitADSFA>();
|
||||
var list2=db.Queryable<UnitADSFA>().GroupBy(it => new
|
||||
var list2 = db.Queryable<UnitADSFA>().GroupBy(it => new
|
||||
{
|
||||
it.A,
|
||||
x=it.A.ToString()
|
||||
x = it.A.ToString()
|
||||
}).ToList();
|
||||
|
||||
var e = E.E1;
|
||||
var query = db.Queryable<T>().Where(p => (p.E | e) == e );
|
||||
var sql1 = query.ToSql().Key;
|
||||
if (!sql1.Contains("="))
|
||||
{
|
||||
throw new Exception("unit error");
|
||||
}
|
||||
}
|
||||
|
||||
public class Unitasfa1sadfa
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public Guid Id { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public bool ItemId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class UnitADSFA
|
||||
public class UnitADSFA
|
||||
{
|
||||
public bool A { get; set; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
||||
public enum E
|
||||
|
||||
{
|
||||
|
||||
E1 = 0x1,
|
||||
|
||||
E2 = 0x2,
|
||||
|
||||
E3 = 0x4,
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class T
|
||||
|
||||
{
|
||||
|
||||
public E E { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user