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
ed7e9be37f
commit
f97e828cb2
@ -24,11 +24,39 @@ namespace OrmTest
|
|||||||
var result2 = db.Queryable<UnitStudent111>()
|
var result2 = db.Queryable<UnitStudent111>()
|
||||||
.Includes(e => e.Exams.Where(s => s.Time >DateTime.Now).ToList()).ToList();
|
.Includes(e => e.Exams.Where(s => s.Time >DateTime.Now).ToList()).ToList();
|
||||||
|
|
||||||
|
Join<MyJoin>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Join<T>() where T : IUserLink
|
||||||
|
{
|
||||||
|
var sql= NewUnitTest.Db
|
||||||
|
.Queryable<UserDO, T>((u, a) => new JoinQueryInfos(JoinType.Inner, u.Id == a.UserId))
|
||||||
|
.Where((u, a) => u.Id == 1)
|
||||||
|
.Select((u, a) => a).ToSql();
|
||||||
|
Check.Exception("SELECT a.* FROM [UserDO] u Inner JOIN [MyJoin] a ON ( [u].[Id] =[a].[UserId]) WHERE ( [u].[Id] = @Id0 )"!= sql.Key,"unit error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class MyJoin : IUserLink
|
||||||
|
{
|
||||||
|
public int UserId { get; set; }
|
||||||
|
}
|
||||||
|
public interface IUserLink
|
||||||
|
{
|
||||||
|
int UserId { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UserDO
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AuthDO : IUserLink
|
||||||
|
{
|
||||||
|
public int UserId { get; set; }
|
||||||
|
|
||||||
|
public int ObjId { get; set; }
|
||||||
|
}
|
||||||
public class UnitStudent111
|
public class UnitStudent111
|
||||||
{
|
{
|
||||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
||||||
|
Loading…
Reference in New Issue
Block a user