public void TestUnfollow() { mockFollowRepository.Setup(x => x.Unfollow(It.IsAny <Follow>())).Returns(follow); var followService = new FollowService(mockFollowRepository.Object); Follow followReturn = followService.Unfollow(follow); Assert.AreEqual(followReturn, follow); }
public ActionResult Unfollow(int user_id) { if (!_userService.Exists(user_id)) { return(NotFound()); } _followService.Unfollow(user_id); return(Ok()); }
public ActionResult Unfollow(long userId) { long accountId = 0; if (Session["userId"] == null || !long.TryParse(Session["userId"].ToString(), out accountId)) { Session.Clear(); return(Redirect("/User/Login")); } if (userId != accountId || userId == 0) { if (FollowService.Unfollow(accountId, userId)) { LogService.Add(accountId, 4, string.Format("{0}成功取消关注{1}", accountId, userId)); return(Json(new AjaxResult { Status = "OK" })); } } return(Json(new AjaxResult { Status = "Error", ErrorMsg = "Unfollow 失败" })); }