Example #1
0
        public void LoginOrRegister(UUnitTestContext testContext)
        {
            var loginRequest = new LoginWithCustomIDRequest
            {
                CustomId      = PlayFabSettings.BuildIdentifier,
                CreateAccount = true,
            };

            clientInstance.LoginWithCustomID(loginRequest, PlayFabUUnitUtils.ApiActionWrapper <LoginResult>(testContext, LoginCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }
Example #2
0
        public void EntityClientLogin(UUnitTestContext testContext)
        {
            var loginRequest = new ClientModels.LoginWithCustomIDRequest
            {
                CustomId      = PlayFabSettings.BuildIdentifier,
                CreateAccount = true,
            };

            clientApi.LoginWithCustomID(loginRequest, PlayFabUUnitUtils.ApiActionWrapper <ClientModels.LoginResult>(testContext, LoginCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }
Example #3
0
 private void PostTestResultsToCloudScript()
 {
     clientInstance.apiSettings.TitleId = testTitleData.titleId;
     clientInstance.LoginWithCustomID(new LoginWithCustomIDRequest {
         CustomId = PlayFabSettings.BuildIdentifier
     }, OnLoginSuccess, OnPostTestResultsError, null, testTitleData.extraHeaders);
 }
Example #4
0
        public void AsyncMultiUserLogin(UUnitTestContext testContext)
        {
            var defaultLoginRequest = new LoginWithCustomIDRequest
            {
                CustomId      = PlayFabSettings.BuildIdentifier,
                CreateAccount = true
            };

            var player1LoginRequest = new LoginWithCustomIDRequest
            {
                CustomId              = PlayFabSettings.BuildIdentifier + "0",
                CreateAccount         = true,
                AuthenticationContext = _player1
            };

            var player2LoginRequest = new LoginWithCustomIDRequest
            {
                CustomId              = PlayFabSettings.BuildIdentifier + "1",
                CreateAccount         = true,
                AuthenticationContext = _player2
            };

            clientApi.LoginWithCustomID(defaultLoginRequest, null, PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
            clientApi.LoginWithCustomID(player1LoginRequest, null, PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
            clientApi.LoginWithCustomID(player2LoginRequest, null, PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);

            _tickAction = () =>
            {
                // return if players not loaded yet
                if (clientApi.authenticationContext.PlayFabId == null || _player1.PlayFabId == null || _player2.PlayFabId == null)
                {
                    return;
                }

                // reset delegate to avoid calling this method again
                _tickAction = null;

                // players must not be equals
                testContext.False(clientApi.authenticationContext.PlayFabId == _player1.PlayFabId);
                testContext.False(clientApi.authenticationContext.PlayFabId == _player2.PlayFabId);
                testContext.False(_player1.PlayFabId == _player2.PlayFabId);
                testContext.EndTest(UUnitFinishState.PASSED, "Two players are successfully login. " + _player1.PlayFabId + ", " + _player2.PlayFabId);
            };
        }
Example #5
0
        public void TestInstCallbacks_GeneralOnly(UUnitTestContext testContext)
        {
            _listener.Register();
            PlayFabHttp.ApiProcessingEventHandler += TestInstCallbacks_GeneralOnly_OnGlobalEventHandler;

            var request = new LoginWithCustomIDRequest {
                CreateAccount = true, CustomId = PlayFabSettings.BuildIdentifier
            };

            clientApi.LoginWithCustomID(request,
                                        PlayFabUUnitUtils.ApiActionWrapper <LoginResult>(testContext, TestInstCallbacks_GeneralOnlyCallback),
                                        PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
            CheckCallbacks(testContext, "OnRequest_InstGl", Callbacks);
            CheckCallbacks(testContext, "OnRequest_InstLogin", Callbacks);
            testContext.IntEquals(2, Callbacks.Count, string.Join(", ", Callbacks.ToArray()));
            Callbacks.Clear();
        }