private void UpdatePlayerStatsCallback(UpdatePlayerStatisticsResult result) { var testContext = (UUnitTestContext)result.CustomData; var getRequest = new GetPlayerStatisticsRequest(); PlayFabClientAPI.GetPlayerStatistics(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetPlayerStatisticsResult>(testContext, GetPlayerStatsCallback2), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void PlayerStatisticsApi(UUnitTestContext testContext) { var getRequest = new GetPlayerStatisticsRequest(); PlayFabClientAPI.GetPlayerStatistics(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetPlayerStatisticsResult>(testContext, GetPlayerStatsCallback1), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
private void GetPlayerStatsCallback1(GetPlayerStatisticsResult result) { var testContext = (UUnitTestContext)result.CustomData; _testInteger = 0; foreach (var eachStat in result.Statistics) { if (eachStat.StatisticName == TEST_STAT_NAME) { _testInteger = eachStat.Value; } } _testInteger = (_testInteger + 1) % 100; // This test is about the Expected value changing - but not testing more complicated issues like bounds var updateRequest = new UpdatePlayerStatisticsRequest { Statistics = new List <StatisticUpdate> { new StatisticUpdate { StatisticName = TEST_STAT_NAME, Value = _testInteger } } }; PlayFabClientAPI.UpdatePlayerStatistics(updateRequest, PlayFabUUnitUtils.ApiActionWrapper <UpdatePlayerStatisticsResult>(testContext, UpdatePlayerStatsCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
private void UpdateUserDataCallback(UpdateUserDataResult result) { var testContext = (UUnitTestContext)result.CustomData; var getRequest = new GetUserDataRequest(); clientInstance.GetUserData(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetUserDataResult>(testContext, GetUserDataCallback2), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
private void GetUserDataCallback1(GetUserDataResult result) { var testContext = (UUnitTestContext)result.CustomData; UserDataRecord userDataRecord; _testInteger = 0; // Default if the data isn't present if (result.Data.TryGetValue(TEST_DATA_KEY, out userDataRecord)) { int.TryParse(userDataRecord.Value, out _testInteger); } _testInteger = (_testInteger + 1) % 100; // This test is about the Expected value changing - but not testing more complicated issues like bounds var updateRequest = new UpdateUserDataRequest { Data = new Dictionary <string, string> { { TEST_DATA_KEY, _testInteger.ToString() } } }; PlayFabClientAPI.UpdateUserData(updateRequest, PlayFabUUnitUtils.ApiActionWrapper <UpdateUserDataResult>(testContext, UpdateUserDataCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void AccountInfo(UUnitTestContext testContext) { var request = new GetAccountInfoRequest { PlayFabId = PlayFabId }; PlayFabClientAPI.GetAccountInfo(request, PlayFabUUnitUtils.ApiActionWrapper <GetAccountInfoResult>(testContext, AcctInfoCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void WriteEvent(UUnitTestContext testContext) { var request = new WriteClientPlayerEventRequest { EventName = "ForumPostEvent", Timestamp = DateTime.UtcNow, Body = new Dictionary <string, object> { { "Subject", "My First Post" }, { "Body", "My awesome Post." } } }; PlayFabClientAPI.WritePlayerEvent(request, PlayFabUUnitUtils.ApiActionWrapper <WriteEventResponse>(testContext, WriteEventCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void InvalidLogin(UUnitTestContext testContext) { // If the setup failed to log in a user, we need to create one. var request = new LoginWithEmailAddressRequest { Email = _userEmail, Password = "******", }; clientInstance.LoginWithEmailAddress(request, PlayFabUUnitUtils.ApiActionWrapper <LoginResult>(testContext, InvalidLoginCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, ExpectedLoginErrorCallback), testContext); }
public void ServerCloudScriptGeneric(UUnitTestContext testContext) { var request = new ExecuteCloudScriptServerRequest { FunctionName = "helloWorld", PlayFabId = FakePlayFabId }; PlayFabServerAPI.ExecuteCloudScript <HelloWorldWrapper>(request, PlayFabUUnitUtils.ApiActionWrapper <ExecuteCloudScriptResult>(testContext, CloudScriptGenericHwCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
public void CloudScriptError(UUnitTestContext testContext) { var request = new ExecuteCloudScriptRequest { FunctionName = "throwError" }; clientInstance.ExecuteCloudScript(request, PlayFabUUnitUtils.ApiActionWrapper <ExecuteCloudScriptResult>(testContext, CloudScriptErrorCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
public void WriteEvent(UUnitTestContext testContext) { var request = new WriteClientPlayerEventRequest { EventName = "ForumPostEvent", Body = new Dictionary <string, object> { { "Subject", "My First Post" }, { "Body", "My awesome Post." } } }; clientInstance.WritePlayerEvent(request, PlayFabUUnitUtils.ApiActionWrapper <WriteEventResponse>(testContext, WriteEventCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
public void AccountInfo(UUnitTestContext testContext) { var request = new GetAccountInfoRequest { PlayFabId = PlayFabId }; clientInstance.GetAccountInfo(request, PlayFabUUnitUtils.ApiActionWrapper <GetAccountInfoResult>(testContext, AcctInfoCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
public void PlayerStatisticsApi(UUnitTestContext testContext) { var getRequest = new GetPlayerStatisticsRequest(); clientInstance.GetPlayerStatistics(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetPlayerStatisticsResult>(testContext, GetPlayerStatsCallback1), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
public void GetServerTime(UUnitTestContext testContext) { clientInstance.GetTime(null, PlayFabUUnitUtils.ApiActionWrapper <GetTimeResult>(testContext, OnGetTimeCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
public void UserCharacter(UUnitTestContext testContext) { var request = new ListUsersCharactersRequest { PlayFabId = PlayFabId // Received from client upon login }; PlayFabClientAPI.GetAllUsersCharacters(request, PlayFabUUnitUtils.ApiActionWrapper <ListUsersCharactersResult>(testContext, GetCharsCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void InvalidRegistration(UUnitTestContext testContext) { var registerRequest = new RegisterPlayFabUserRequest { Username = "******", // Provide invalid inputs for multiple parameters, which will show up in errorDetails Email = "x", // Provide invalid inputs for multiple parameters, which will show up in errorDetails Password = "******", // Provide invalid inputs for multiple parameters, which will show up in errorDetails }; PlayFabClientAPI.RegisterPlayFabUser(registerRequest, PlayFabUUnitUtils.ApiActionWrapper <RegisterPlayFabUserResult>(testContext, InvalidRegistrationCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, ExpectedRegisterErrorCallback), testContext, testTitleData.extraHeaders); }
public void ClientLeaderBoard(UUnitTestContext testContext) { var clientRequest = new GetLeaderboardRequest { MaxResultsCount = 3, StatisticName = TEST_STAT_NAME, }; PlayFabClientAPI.GetLeaderboard(clientRequest, PlayFabUUnitUtils.ApiActionWrapper <GetLeaderboardResult>(testContext, GetClientLbCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void LoginOrRegister(UUnitTestContext testContext) { var loginRequest = new LoginWithCustomIDRequest { CustomId = PlayFabSettings.BuildIdentifier, CreateAccount = true, }; PlayFabClientAPI.LoginWithCustomID(loginRequest, PlayFabUUnitUtils.ApiActionWrapper <LoginResult>(testContext, LoginCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void CloudScriptGeneric(UUnitTestContext testContext) { var request = new ExecuteCloudScriptRequest { FunctionName = "helloWorld" }; PlayFabClientAPI.ExecuteCloudScript <HelloWorldWrapper>(request, PlayFabUUnitUtils.ApiActionWrapper <ExecuteCloudScriptResult>(testContext, CloudScriptGenericHwCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void LoginWithAdvertisingId(UUnitTestContext testContext) { #if (!UNITY_IOS && !UNITY_ANDROID) || (!UNITY_5_3 && !UNITY_5_4 && !UNITY_5_5) PlayFabSettings.AdvertisingIdType = PlayFabSettings.AD_TYPE_ANDROID_ID; PlayFabSettings.AdvertisingIdValue = "PlayFabTestId"; #endif var loginRequest = new LoginWithCustomIDRequest { CustomId = PlayFabSettings.BuildIdentifier, CreateAccount = true, }; PlayFabClientAPI.LoginWithCustomID(loginRequest, PlayFabUUnitUtils.ApiActionWrapper <LoginResult>(testContext, AdvertLoginCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext, testTitleData.extraHeaders); }
public void InvalidLogin(UUnitTestContext testContext) { // If the setup failed to log in a user, we need to create one. var request = new LoginWithEmailAddressRequest { TitleId = PlayFabSettings.TitleId, Email = _userEmail, Password = "******", }; PlayFabClientAPI.LoginWithEmailAddress(request, PlayFabUUnitUtils.ApiActionWrapper <LoginResult>(testContext, InvalidLoginCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, ExpectedLoginErrorCallback), testContext, testTitleData.extraHeaders); }
public void UserDataApi(UUnitTestContext testContext) { var getRequest = new GetUserDataRequest(); clientInstance.GetUserData(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetUserDataResult>(testContext, GetUserDataCallback1), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }