public void connection_must_be_created_after_toggle_when_connection_not_exists() { var user1 = DatabaseHelper.CreateValidUser("user1"); var user2 = DatabaseHelper.CreateValidUser("user2"); _userReposiotry.Create(user1); _userReposiotry.Create(user2); _unitOfWork.Commit(); bool userHaveConnection = _userConnectionService.ToggleConnection(user1.Id, user2.Id); _unitOfWork.Commit(); Assert.IsTrue(userHaveConnection, "User must have connection after toggle connection"); Assert.IsTrue(_userConnectionService.IsConnectionBetweenUsers(user1.Id, user2.Id), "User must have connection after toggle connection"); }
public ActionResult ToggleConnection(Guid toUserId) { bool usersHasConnection = _userConnectionService.ToggleConnection(this.CurrentUserSessionContext().UserId, toUserId); _unitOfWork.Commit(); return(Json(new { @success = true, @usersHasConnection = usersHasConnection })); }