mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Add unit test
This commit is contained in:
parent
bef3cf9a9f
commit
4fc25dcfeb
@ -13,7 +13,7 @@ namespace SqlSugarDemo
|
|||||||
{
|
{
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
[Navigate(NavigateType.OneToOne, nameof(user_id))]
|
[Navigate(NavigateType.OneToOne, nameof(user_id))]
|
||||||
public user_name_simple CommentUser { set; get; }
|
public user_name_simple UserInfo { set; get; }
|
||||||
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
[Navigate(NavigateType.OneToOne, nameof(reply_user_id))]
|
[Navigate(NavigateType.OneToOne, nameof(reply_user_id))]
|
||||||
|
@ -26,27 +26,35 @@ namespace OrmTest
|
|||||||
}).ExecuteReturnIdentity();
|
}).ExecuteReturnIdentity();
|
||||||
db.Insertable(new poetry_video_comment()
|
db.Insertable(new poetry_video_comment()
|
||||||
{
|
{
|
||||||
first_reply_id = 1,
|
first_reply_id = 0,
|
||||||
reply_user_id = userid2,
|
reply_user_id = 0,
|
||||||
user_id = userid2
|
user_id = 0
|
||||||
}).ExecuteReturnIdentity();
|
}).ExecuteReturnIdentity();
|
||||||
db.Insertable(new poetry_video_comment()
|
db.Insertable(new poetry_video_comment()
|
||||||
{
|
{
|
||||||
first_reply_id = 1,
|
first_reply_id = 2,
|
||||||
reply_user_id = userid,
|
reply_user_id = userid,
|
||||||
user_id = userid2
|
user_id = userid2
|
||||||
}).ExecuteReturnIdentity();
|
}).ExecuteReturnIdentity();
|
||||||
db.Insertable(new poetry_video_comment()
|
var x = db.Queryable<poetry_video_comment>().ToList();
|
||||||
{
|
//db.Insertable(new poetry_video_comment()
|
||||||
first_reply_id = 11,
|
//{
|
||||||
reply_user_id = 11,
|
// first_reply_id = 11,
|
||||||
user_id = 11
|
// reply_user_id = 11,
|
||||||
}).ExecuteReturnIdentity();
|
// user_id = 11
|
||||||
|
//}).ExecuteReturnIdentity();
|
||||||
var list = db.Queryable<poetry_video_comment>()
|
var list = db.Queryable<poetry_video_comment>()
|
||||||
.Includes(o => o.FirstReply, o => o.ReplyUser)
|
.Includes(o => o.FirstReply, o => o.ReplyUser)
|
||||||
.Includes(o => o.FirstReply, o => o.CommentUser)
|
.Includes(o => o.FirstReply, o => o.UserInfo)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
if (list.Last().FirstReply.UserInfo == null)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
if (list.Last().FirstReply.ReplyUser == null)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user