public void PlayerCanRemoveAFriendRequest() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); authHelper.loginToAccount("userTwo"); DenyFriendRequestRequest friendRequest = new DenyFriendRequestRequest() { FriendId = authHelper.getAccountId("userOne"), }; DenyFriendRequestResponse acceptResponse = client.DenyFriendRequest(friendRequest); Assert.AreEqual(acceptResponse.Status.IsSuccess, true); ViewFriendRequestsResponse friendResponse = client.ViewFriendRequests(new ViewFriendRequestsRequest()); Assert.AreEqual(friendResponse.Status.IsSuccess, true); Assert.AreEqual(0, friendResponse.IncomingFriends.Count); }
/// <summary> /// Send Friend Request Button pressed /// </summary> private async void SendFriendRequest(object sender, RoutedEventArgs e) { // Split at Descriminator string[] strings = SendFriendTB.Text.Split('#'); if (strings.Count() == 2) { // Send Friend Request SendFriendRequestResponse result = await RESTCalls.SendFriendRequest(strings[0], Convert.ToInt32(strings[1])); if (result != null && result.Message != null) { FriendRequestStatus.Text = result.Message; //App.GetString(result.Message.Replace(' ', '\0')); //TODO: Translate } else { FriendRequestStatus.Text = App.GetString("/Controls/Success"); } } else { // Invalid input FriendRequestStatus.Text = App.GetString("/Controls/NeedDesc"); } }
public void BlockingAPlayerAfterSendingThemAFriendRequestRemovesTheFriendRequest() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); BlockPlayerRequest blockRequest = new BlockPlayerRequest() { UserIdToBlock = authHelper.getAccountId("userTwo") }; client.BlockPlayer(blockRequest); authHelper.loginToAccount("userTwo"); // Make sure the players are not friends. ViewFriendRequestsResponse blockFriendListResponse = client.ViewFriendRequests(new ViewFriendRequestsRequest()); Assert.AreEqual(blockFriendListResponse.Status.IsSuccess, true); Assert.AreEqual(0, blockFriendListResponse.IncomingFriends.Count); }
public void OriginalPlayerCanViewFriendAfterOtherPlayerAcceptsRequest() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); authHelper.loginToAccount("userTwo"); AcceptFriendRequestRequest friendRequest = new AcceptFriendRequestRequest() { FriendId = authHelper.getAccountId("userOne"), }; AcceptFriendRequestResponse acceptResponse = client.AcceptFriendRequest(friendRequest); Assert.AreEqual(acceptResponse.Status.IsSuccess, true); authHelper.loginToAccount("userOne"); ViewFriendsResponse friendResponse = client.ViewFriends(new ViewFriendsRequest()); Assert.AreEqual(friendResponse.Status.IsSuccess, true); Assert.AreEqual(1, friendResponse.Friends.Count); Assert.IsTrue(friendResponse.Friends.Any((friend) => friend.Id == authHelper.getAccountId("userTwo"))); }
public void PlayerCanSendFriendRequestToOtherPlayer() { SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); }
public void BlockingAPlayerRemovesThemAsAFriend() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); authHelper.loginToAccount("userTwo"); AcceptFriendRequestRequest friendRequest = new AcceptFriendRequestRequest() { FriendId = authHelper.getAccountId("userOne"), }; AcceptFriendRequestResponse acceptResponse = client.AcceptFriendRequest(friendRequest); Assert.AreEqual(acceptResponse.Status.IsSuccess, true); ViewFriendsResponse friendResponse = client.ViewFriends(new ViewFriendsRequest()); Assert.AreEqual(friendResponse.Status.IsSuccess, true); Assert.AreEqual(1, friendResponse.Friends.Count); Assert.IsTrue(friendResponse.Friends.Any((friend) => friend.Id == authHelper.getAccountId("userOne"))); BlockPlayerRequest blockRequest = new BlockPlayerRequest() { UserIdToBlock = authHelper.getAccountId("userOne") }; BlockPlayerResponse blockResponse = client.BlockPlayer(blockRequest); Assert.AreEqual(blockResponse.Status.IsSuccess, true); // Make sure the players are not friends. ViewFriendsResponse blockFriendListResponse = client.ViewFriends(new ViewFriendsRequest()); Assert.AreEqual(blockFriendListResponse.Status.IsSuccess, true); Assert.AreEqual(0, blockFriendListResponse.Friends.Count); authHelper.loginToAccount("userOne"); // Make sure the players are not friends. ViewFriendsResponse blockFriendListResponseUserOne = client.ViewFriends(new ViewFriendsRequest()); Assert.AreEqual(blockFriendListResponseUserOne.Status.IsSuccess, true); Assert.AreEqual(0, blockFriendListResponseUserOne.Friends.Count); }
public void PlayerCannotSendMultipleFriendRequests() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); var errorResponse = client.SendFriendRequest(request); Assert.AreEqual(errorResponse.Status.IsSuccess, false); Assert.AreEqual(errorResponse.Status.Detail, ResponseType.DUPLICATE.ToString()); }
public void WhenAPlayerGetsAFriendRequestTheyCanSeeIt() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); authHelper.loginToAccount("userTwo"); ViewFriendRequestsResponse friendRequestresponse = client.ViewFriendRequests(new ViewFriendRequestsRequest()); Assert.AreEqual(friendRequestresponse.Status.IsSuccess, true); Assert.AreEqual(1, friendRequestresponse.IncomingFriends.Count); Assert.IsTrue(friendRequestresponse.IncomingFriends.Any((user) => user.Id == authHelper.getAccountId("userOne"))); }
public void PlayerCanAcceptAFriendRequest() { authHelper.loginToAccount("userOne"); SendFriendRequestRequest request = new SendFriendRequestRequest() { FriendId = authHelper.getAccountId("userTwo") }; SendFriendRequestResponse response = client.SendFriendRequest(request); Assert.AreEqual(response.Status.IsSuccess, true); authHelper.loginToAccount("userTwo"); AcceptFriendRequestRequest friendRequest = new AcceptFriendRequestRequest() { FriendId = authHelper.getAccountId("userOne"), }; AcceptFriendRequestResponse acceptResponse = client.AcceptFriendRequest(friendRequest); Assert.AreEqual(acceptResponse.Status.IsSuccess, true); }