public void ShouldAddFriend() { var ocelot = new Friend("Ocelot", new Coordinate(500, 100)); MockFriendsRepository.AddFriend(ocelot); Assert.Equal(4, friends.Count()); }
public void AddFriend(AddFriendModel addModel) { var exists = _userRepository.GetUserByPhoneNumber(addModel.TargetPhoneNumber); if (exists == null) { throw new Exception("User not found!"); } var friendsList = _friendsRepository.GetAll(addModel.PhoneNumber); if (friendsList.Contains(addModel.TargetPhoneNumber)) { throw new Exception("Friend already in the list!"); } _friendsRepository.AddFriend(addModel.PhoneNumber, addModel.TargetPhoneNumber); }
public async Task AddFriend(FriendViewModel viewModel) { await _friendsRepository.AddFriend(_mapper.Map <Friend>(viewModel)); }