public void LeaderBoard() { var clientRequest = new ClientModels.GetLeaderboardAroundCurrentUserRequest(); clientRequest.MaxResultsCount = 3; clientRequest.StatisticName = TEST_STAT_NAME; var clientTask = PlayFabClientAPI.GetLeaderboardAroundCurrentUserAsync(clientRequest); clientTask.Wait(); UUnitAssert.Null(clientTask.Result.Error, "Failed to get client leaderboard"); UUnitAssert.NotNull(clientTask.Result.Result, "Failed to get client leaderboard"); UUnitAssert.NotNull(clientTask.Result.Result.Leaderboard, "Failed to get client leaderboard"); UUnitAssert.True(clientTask.Result.Result.Leaderboard.Count > 0, "Leaderboard does not contain enough entries."); var serverRequest = new ServerModels.GetLeaderboardAroundCharacterRequest(); serverRequest.MaxResultsCount = 3; serverRequest.StatisticName = TEST_STAT_NAME; serverRequest.CharacterId = characterId; serverRequest.PlayFabId = playFabId; var serverTask = PlayFabServerAPI.GetLeaderboardAroundCharacterAsync(serverRequest); clientTask.Wait(); UUnitAssert.Null(serverTask.Result.Error, "Failed to get server leaderboard"); UUnitAssert.NotNull(serverTask.Result.Result, "Failed to get server leaderboard"); UUnitAssert.NotNull(serverTask.Result.Result.Leaderboard, "Failed to get server leaderboard"); UUnitAssert.True(serverTask.Result.Result.Leaderboard.Count > 0, "Leaderboard does not contain enough entries."); }
public void LeaderBoard() { var clientRequest = new ClientModels.GetLeaderboardAroundCurrentUserRequest(); clientRequest.MaxResultsCount = 3; clientRequest.StatisticName = TEST_STAT_NAME; var clientTask = Client.GetLeaderboardAroundCurrentUserAsync(clientRequest); try { clientTask.Wait(); } catch (Exception ex) { UUnitAssert.True(false, ex.Message); } UUnitAssert.NotNull(clientTask.Result, "Failed to get client leaderboard"); UUnitAssert.True(clientTask.Result.Count > 0, "Leaderboard does not contain enough entries."); var serverRequest = new ServerModels.GetLeaderboardAroundCharacterRequest(); serverRequest.MaxResultsCount = 3; serverRequest.StatisticName = TEST_STAT_NAME; serverRequest.CharacterId = characterId; serverRequest.PlayFabId = playFabId; var serverTask = Server.GetLeaderboardAroundCharacterAsync(serverRequest); try { clientTask.Wait(); } catch (Exception ex) { UUnitAssert.True(false, ex.Message); } UUnitAssert.NotNull(serverTask.Result, "Failed to get server leaderboard"); UUnitAssert.True(serverTask.Result.Count > 0, "Leaderboard does not contain enough entries."); }
public void LeaderBoard() { var clientRequest = new ClientModels.GetLeaderboardAroundCurrentUserRequest(); clientRequest.MaxResultsCount = 3; clientRequest.StatisticName = TEST_STAT_NAME; PlayFabClientAPI.GetLeaderboardAroundCurrentUser(clientRequest, GetClientLbCallback, SharedErrorCallback); WaitForApiCalls(); UUnitAssert.Equals("Get Client Leaderboard Successful", lastReceivedMessage); // Testing anything more would be testing actual functionality of the Leaderboard, which is outside the scope of this test. var serverRequest = new ServerModels.GetLeaderboardAroundCharacterRequest(); serverRequest.MaxResultsCount = 3; serverRequest.StatisticName = TEST_STAT_NAME; serverRequest.CharacterId = characterId; serverRequest.PlayFabId = playFabId; PlayFabServerAPI.GetLeaderboardAroundCharacter(serverRequest, GetServerLbCallback, SharedErrorCallback); WaitForApiCalls(); UUnitAssert.Equals("Get Server Leaderboard Successful", lastReceivedMessage); }