예제 #1
0
        /// <summary>
        /// Convert account.
        /// </summary>
        /// <param name="info">Indicating the account information.</param>
        /// <returns>Async response.</returns>
        public async Task <GuestConvertResponse> GuestConvertAsync(GuestConvertInfo info)
        {
            var url      = this.GenerateApiEndpoint("accounts", "guestconvert");
            var response = await this.httpClient.SendAsyncWithException <GuestConvertInfo, GuestConvertResponse>(
                HttpMethod.Post,
                url,
                info);

            return(response);
        }
예제 #2
0
        //-------------------------------------------------------------------------
        public void guestConvert(GuestConvertInfo request, OnUCenterConvert handler)
        {
            if (WWWGuestConvert != null)
            {
                return;
            }

            GuestConvertHandler = new Action <UCenterResponseStatus, GuestConvertResponse, UCenterError>(handler);

            string http_url = _genUrl("guestconvert");

            string param = EbTool.jsonSerialize(request);

            byte[] bytes = Encoding.UTF8.GetBytes(param);

            Dictionary <string, string> headers = _genHeader(bytes.Length);

            WWWGuestConvert = new WWW(http_url, bytes, headers);
        }
        public async Task E2E_AppClient_GuestAccess_And_Convert_Test()
        {
            var guestAccessInfo = new GuestAccessInfo()
            {
                AppId  = TestAppId,
                Device = TestDevice
            };
            var guestAccessResponse = await acClient.GuestAccessAsync(guestAccessInfo);

            Assert.IsNotNull(guestAccessResponse.AccountId);
            Assert.IsNotNull(guestAccessResponse.AccountName);
            Assert.AreEqual(guestAccessResponse.AccountType, AccountType.Guest);
            Assert.IsNotNull(guestAccessResponse.Token);

            var convertInfo = new GuestConvertInfo
            {
                AppId         = TestAppId,
                AccountId     = guestAccessResponse.AccountId,
                AccountName   = $"account.{GenerateRandomString()}",
                Password      = ValidAccountPassword,
                SuperPassword = ValidAccountPassword,
                Name          = GenerateRandomString(),
                Phone         = GenerateRandomString(),
                Email         = GenerateRandomString(),
                Identity      = GenerateRandomString(),
                Gender        = Gender.Female
            };

            var convertResponse = await acClient.GuestConvertAsync(convertInfo);

            Assert.IsNotNull(convertResponse.AccountId);
            Assert.IsNotNull(convertResponse.AccountId, convertInfo.AccountId);
            Assert.AreEqual(convertResponse.AccountName, convertInfo.AccountName);
            Assert.AreEqual(convertResponse.AccountType, AccountType.NormalAccount);
            Assert.AreEqual(convertResponse.AccountStatus, AccountStatus.Active);
            Assert.AreEqual(convertResponse.Identity, convertInfo.Identity);
            Assert.AreEqual(convertResponse.Name, convertInfo.Name);
            Assert.AreEqual(convertResponse.Phone, convertInfo.Phone);
            Assert.AreEqual(convertResponse.Email, convertInfo.Email);
            Assert.AreEqual(convertResponse.Gender, convertInfo.Gender);
        }