public IEnumerator ReactCorrectlyToReportClick() { var id = "test-id-1"; yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, id)); var entry = TestHelpers_Friends.GetEntry(view, id); Assert.IsNotNull(entry); bool reportPlayerSent = false; Action <string, string> callback = (name, payload) => { if (name == "ReportPlayer") { reportPlayerSent = true; } }; WebInterface.OnMessageFromEngine += callback; entry.menuButton.onClick.Invoke(); Assert.IsTrue(controller.view.friendsList.contextMenuPanel.gameObject.activeSelf); controller.view.friendsList.contextMenuPanel.reportButton.onClick.Invoke(); Assert.IsTrue(reportPlayerSent); WebInterface.OnMessageFromEngine -= callback; }
public IEnumerator ReactCorrectlyToFriendApproved() { var id = "test-id-1"; yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, id, FriendshipAction.APPROVED)); var entry = TestHelpers_Friends.GetEntry(view, id); Assert.IsNotNull(entry); friendsController.RaiseUpdateFriendship(id, FriendshipAction.DELETED); entry = controller.view.friendsList.GetEntry(id) as FriendEntry; Assert.IsNull(entry); }
public IEnumerator ReactCorrectlyToWhisperClick() { var id = "test-id-1"; yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, id)); var entry = TestHelpers_Friends.GetEntry(view, id); Assert.IsNotNull(entry); bool pressedWhisper = false; controller.OnPressWhisper += (x) => { pressedWhisper = x == id; }; entry.whisperButton.onClick.Invoke(); Assert.IsTrue(pressedWhisper); }
public IEnumerator ReactCorrectlyToFriendRejected() { var id = "test-id-1"; yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, id)); var fentry = TestHelpers_Friends.GetEntry(view, id); Assert.IsNotNull(fentry); friendsController.RaiseUpdateFriendship(id, FriendshipAction.REQUESTED_FROM); friendsController.RaiseUpdateFriendship(id, FriendshipAction.REJECTED); var entry = controller.view.friendRequestsList.GetEntry(id); Assert.IsNull(entry); }
public IEnumerator ReactCorrectlyToPassportClick() { var id = "test-id-1"; yield return(TestHelpers_Friends.FakeAddFriend(friendsController, view, id)); var entry = TestHelpers_Friends.GetEntry(view, id); Assert.IsNotNull(entry); var currentPlayerId = Resources.Load <StringVariable>(UserContextMenu.CURRENT_PLAYER_ID); entry.menuButton.onClick.Invoke(); Assert.AreNotEqual(id, currentPlayerId.Get()); view.friendsList.contextMenuPanel.passportButton.onClick.Invoke(); Assert.AreEqual(id, currentPlayerId.Get()); }