public void ShowIfFriendsIsAddedToRolCorrectly() { FriendsController_Mock friendsController = new FriendsController_Mock(); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "1", friendshipStatus = FriendshipStatus.FRIEND }); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "2", friendshipStatus = FriendshipStatus.FRIEND }); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "3", friendshipStatus = FriendshipStatus.FRIEND }); var profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "Temp", userId = "1" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "ta", userId = "2" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "tion", userId = "3" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); FriendsSearchPromptController controller = new FriendsSearchPromptController(promptView, friendsController); controller.Show(); controller.SetUsersInRolList(new List <string>() { "1" }); Assert.IsTrue(controller.userViewsHandler.userElementViews["1"].removeButton.gameObject.activeSelf); Assert.IsTrue(controller.userViewsHandler.userElementViews["2"].addButton.gameObject.activeSelf); Assert.IsTrue(controller.userViewsHandler.userElementViews["3"].addButton.gameObject.activeSelf); controller.Dispose(); }
public SectionSceneAdminsSettingsController(SectionSceneAdminsSettingsView view, IFriendsController friendsController) { this.view = view; friendsSearchPromptController = new FriendsSearchPromptController(view.GetAdminsSearchPromptView(), friendsController); usersSearchPromptController = new UsersSearchPromptController(view.GetBlockedSearchPromptView()); view.OnSearchFriendButtonPressed += () => friendsSearchPromptController.Show(); view.OnSearchUserButtonPressed += () => usersSearchPromptController.Show(); friendsSearchPromptController.OnAddUser += OnAddAdminPressed; friendsSearchPromptController.OnRemoveUser += OnRemoveAdminPressed; usersSearchPromptController.OnAddUser += OnAddBannedUserPressed; usersSearchPromptController.OnRemoveUser += OnRemoveBannedUserPressed; }
public void SearchFriendsCorrectly() { FriendsController_Mock friendsController = new FriendsController_Mock(); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "1", friendshipStatus = FriendshipStatus.FRIEND }); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "2", friendshipStatus = FriendshipStatus.FRIEND }); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "3", friendshipStatus = FriendshipStatus.FRIEND }); var profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "Temp", userId = "1" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "ta", userId = "2" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "tion", userId = "3" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); FriendsSearchPromptController controller = new FriendsSearchPromptController(promptView, friendsController); controller.Show(); promptView.searchInputField.OnSubmit("Temp"); Assert.IsTrue(controller.userViewsHandler.userElementViews["1"].gameObject.activeSelf); Assert.IsFalse(controller.userViewsHandler.userElementViews["2"].gameObject.activeSelf); Assert.IsFalse(controller.userViewsHandler.userElementViews["3"].gameObject.activeSelf); controller.Dispose(); }
public void ShowFriendsCorrectly() { FriendsController_Mock friendsController = new FriendsController_Mock(); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "1", friendshipStatus = FriendshipStatus.FRIEND }); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "2", friendshipStatus = FriendshipStatus.FRIEND }); friendsController.AddFriend(new FriendsController.UserStatus() { userId = "3", friendshipStatus = FriendshipStatus.FRIEND }); var profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "Temp", userId = "1" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "ta", userId = "2" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); profile = ScriptableObject.CreateInstance <UserProfile>(); profile.UpdateData(new UserProfileModel() { name = "tion", userId = "3" }); UserProfileController.userProfilesCatalog.Add(profile.userId, profile); FriendsSearchPromptController controller = new FriendsSearchPromptController(promptView, friendsController); controller.Show(); Assert.AreEqual(3, promptView.friendListParent.childCount); Assert.AreEqual("Temp", controller.userViewsHandler.userElementViews["1"].textUserName.text); Assert.AreEqual("ta", controller.userViewsHandler.userElementViews["2"].textUserName.text); Assert.AreEqual("tion", controller.userViewsHandler.userElementViews["3"].textUserName.text); controller.Dispose(); }