mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 20:43:46 +08:00
Add unit test
This commit is contained in:
@@ -340,6 +340,33 @@ namespace OrmTest
|
|||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
var test8 = db.Queryable<Order>().Select(it => new
|
||||||
|
{
|
||||||
|
CustomId = it.CustomId,
|
||||||
|
OrderId = it.Id,
|
||||||
|
OrderName = it.Name,
|
||||||
|
disCount = SqlFunc.Subqueryable<Custom>().Where(c =>it.CustomId==c.Id).ToList(c=>c.Id)
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (test8.First().CustomId != test8.First().disCount.First())
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
|
||||||
|
var test9 = db.Queryable<Order>().Select(it => new xxx
|
||||||
|
{
|
||||||
|
CustomId = it.CustomId,
|
||||||
|
OrderId = it.Id,
|
||||||
|
OrderName = it.Name,
|
||||||
|
disCount = SqlFunc.Subqueryable<Custom>().Where(c => it.CustomId == c.Id).ToList(c => c.Id)
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (test9.First().CustomId != test8.First().disCount.First())
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private static void TestGetAll(SqlSugarClient db)
|
private static void TestGetAll(SqlSugarClient db)
|
||||||
{
|
{
|
||||||
@@ -406,6 +433,15 @@ namespace OrmTest
|
|||||||
public List<OrderItem> disCount { get; set; }
|
public List<OrderItem> disCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class xxx
|
||||||
|
{
|
||||||
|
public int CustomId { get; set; }
|
||||||
|
public int OrderId { get; set; }
|
||||||
|
public string OrderName { get; set; }
|
||||||
|
public List<int> disCount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
[SugarTable("LibBookSubscription1xx")]
|
[SugarTable("LibBookSubscription1xx")]
|
||||||
public class LibBookSubscription1
|
public class LibBookSubscription1
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user