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 PopoverViewModel CreatePopoverViewModel(Guid fromUserId, Guid toUserId) { return(new PopoverViewModel { User = _userService.FindById(toUserId), YouObserveUser = fromUserId != toUserId && _userConnectionService.IsConnectionBetweenUsers(fromUserId, toUserId), UserObservesYou = fromUserId != toUserId && _userConnectionService.IsConnectionBetweenUsers(toUserId, fromUserId), IsThisSameUser = fromUserId == toUserId, AmountOfAllObservedByUser = _userConnectionService.AmountOfAllObservedByUser(toUserId), AmountOfAllUserObservers = _userConnectionService.AmountOfAllUserObservers(toUserId) }); }