예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
        public void PlayerStatisticsApi(UUnitTestContext testContext)
        {
            var getRequest = new GetPlayerStatisticsRequest();

            clientInstance.GetPlayerStatistics(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetPlayerStatisticsResult>(testContext, GetPlayerStatsCallback1), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }
예제 #14
0
 public void GetServerTime(UUnitTestContext testContext)
 {
     clientInstance.GetTime(null, PlayFabUUnitUtils.ApiActionWrapper <GetTimeResult>(testContext, OnGetTimeCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
 }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
        }
예제 #20
0
        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);
        }
예제 #21
0
        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);
        }
예제 #22
0
        public void UserDataApi(UUnitTestContext testContext)
        {
            var getRequest = new GetUserDataRequest();

            clientInstance.GetUserData(getRequest, PlayFabUUnitUtils.ApiActionWrapper <GetUserDataResult>(testContext, GetUserDataCallback1), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }