public async Task E2E_AppClient_Login_Incorrect_Password_Test()
        {
            var registerResponse = await CreateTestAccount();

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountLoginFailedPasswordNotMatch, async() =>
            {
                await cClient.AccountLoginAsync(new AccountLoginInfo
                {
                    AccountName = registerResponse.AccountName,
                    Password    = InValidAccountPassword
                });
            });
        }
        public void E2E_AppServer_VerifyAccount_AccountNotExist_Test()
        {
            var appVerifyAccountInfo = new AppVerifyAccountInfo
            {
                AppId        = TestAppId,
                AppSecret    = TestAppSecret,
                AccountId    = "___Test_Account_No_Exist___",
                AccountToken = ValidAccountPassword
            };

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountNotExist,
                                                 async() => { await sClient.AppVerifyAccountAsync(appVerifyAccountInfo); });
        }
        public async Task E2E_AppClient_Register_Twice_Test()
        {
            var info = new AccountRegisterInfo
            {
                AccountName   = GenerateRandomString(),
                Password      = ValidAccountPassword,
                SuperPassword = ValidAccountPassword,
                Name          = GenerateRandomString(),
                IdentityNum   = GenerateRandomString(),
                PhoneNum      = GenerateRandomString(),
                Email         = "*****@*****.**",
                Sex           = Sex.Female
            };

            await cClient.AccountRegisterAsync(info);

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountRegisterFailedAlreadyExist,
                                                 async() => { await cClient.AccountRegisterAsync(info); });
        }
        public async Task E2E_AppServer_ReadAccountData_IncorrectAppSecret_Test()
        {
            var registerResponse = await CreateTestAccount();

            var loginResponse = await cClient.AccountLoginAsync(new AccountLoginInfo
            {
                AccountName = registerResponse.AccountName,
                Password    = ValidAccountPassword
            });

            var accountData = new AppAccountDataInfo
            {
                AppId     = TestAppId,
                AppSecret = InvalidAppSecret,
                AccountId = loginResponse.AccountId
            };

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AppAuthFailedSecretNotMatch,
                                                 async() => { await sClient.AppReadAccountDataAsync(accountData); });
        }
        public async Task E2E_AppServer_VerifyAccount_IncorrectAccountToken_Test()
        {
            var registerResponse = await CreateTestAccount();

            var loginResponse = await cClient.AccountLoginAsync(new AccountLoginInfo
            {
                AccountName = registerResponse.AccountName,
                Password    = ValidAccountPassword
            });

            var appVerifyAccountInfo = new AppVerifyAccountInfo
            {
                AppId        = TestAppId,
                AppSecret    = TestAppSecret,
                AccountId    = loginResponse.AccountId,
                AccountToken = InValidAccountToken
            };

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountLoginFailedTokenNotMatch,
                                                 async() => { await sClient.AppVerifyAccountAsync(appVerifyAccountInfo); });
        }
        public async Task E2E_AppServer_VerifyAccount_AppNotExist_Test()
        {
            var registerResponse = await CreateTestAccount();

            var loginResponse = await cClient.AccountLoginAsync(new AccountLoginInfo
            {
                AccountName = registerResponse.AccountName,
                Password    = ValidAccountPassword
            });

            var appVerifyAccountInfo = new AppVerifyAccountInfo
            {
                AppId        = "___Test_App_No_Exist___",
                AppSecret    = TestAppSecret,
                AccountId    = registerResponse.AccountId,
                AccountToken = loginResponse.Token
            };

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AppNotExit,
                                                 async() => { await sClient.AppVerifyAccountAsync(appVerifyAccountInfo); });
        }
        public async Task E2E_AppClient_Reset_Password_Test()
        {
            var registerResponse = await CreateTestAccount();

            var resetInfo = new AccountResetPasswordInfo
            {
                AccountId     = registerResponse.AccountId,
                Password      = "******",
                SuperPassword = ValidAccountPassword
            };

            var resetPasswordResponse = await cClient.AccountResetPasswordAsync(resetInfo);

            var loginInfo = new AccountLoginInfo
            {
                AccountName = registerResponse.AccountName,
                Password    = ValidAccountPassword
            };

            TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountLoginFailedPasswordNotMatch,
                                                 async() => { await cClient.AccountLoginAsync(loginInfo); });
        }
示例#8
0
        public async Task E2E_AppClient_Register_WithInvalidChars_Test()
        {
            var info = new AccountRegisterInfo
            {
                Password      = ValidAccountPassword,
                SuperPassword = ValidAccountPassword,
                Name          = GenerateRandomString(),
                IdentityNum   = GenerateRandomString(),
                PhoneNum      = GenerateRandomString(),
                Email         = GenerateRandomString() + "@test.com",
                Sex           = Sex.Female
            };

            // TOOD: Change ErrorCode in next client refresh
            info.AccountName = "$%^";
            await TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountRegisterFailedAlreadyExist,
                                                       async() => { await acClient.AccountRegisterAsync(info); });

            info.AccountName = "张无忌";
            await TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AccountRegisterFailedAlreadyExist,
                                                       async() => { await acClient.AccountRegisterAsync(info); });
        }
        public async Task E2E_AppServer_WriteAccountData_InvalidAppSecret_Test()
        {
            var registerResponse = await CreateTestAccount();

            var loginResponse = await acClient.AccountLoginAsync(new AccountLoginInfo
            {
                AccountName = registerResponse.AccountName,
                Password    = ValidAccountPassword
            });

            var data        = @"{ 'id': 1, 'name': 'abc'}";
            var accountData = new AppAccountDataInfo
            {
                AppId     = TestAppId,
                AppSecret = InvalidAppSecret,
                AccountId = loginResponse.AccountId,
                Data      = data
            };

            await TestExpector.ExpectUCenterErrorAsync(UCenterErrorCode.AppAuthFailedSecretNotMatch,
                                                       async() => { await asClient.AppWriteAccountDataAsync(accountData); });
        }