コード例 #1
0
ファイル: LoginTests.cs プロジェクト: singlag888/aft-regov2
        public async void Unable_to_login_if_password_is_incorrect()
        {
            var e = await AsyncTestHelper.ThrowsAsync <MemberApiProxyException>(
                () => PlayerWebservice.Login(CreateLoginRequest(_registrationData.Username, "some invalid password")));

            Assert.IsNotEmpty(e.Exception.ErrorMessage);
            Assert.AreEqual(PlayerAccountResponseCode.UsernamePasswordCombinationIsNotValid.ToString(), e.Exception.ErrorCode);
        }
コード例 #2
0
ファイル: LoginTests.cs プロジェクト: singlag888/aft-regov2
        public async void Unable_to_login_if_username_does_not_exist()
        {
            var e = await AsyncTestHelper.ThrowsAsync <MemberApiProxyException>(
                () => PlayerWebservice.Login(CreateLoginRequest("notExistingUsername", _registrationData.Password)));

            Assert.IsNotEmpty(e.Exception.ErrorMessage);
            Assert.That(e.Exception.ErrorCode, Is.EqualTo(PlayerAccountResponseCode.UsernamePasswordCombinationIsNotValid.ToString()));
        }
コード例 #3
0
ファイル: LoginTests.cs プロジェクト: singlag888/aft-regov2
        public async void Unable_to_login_if_username_or_password_is_empty()
        {
            var e = await AsyncTestHelper.ThrowsAsync <MemberApiProxyException>(
                () => PlayerWebservice.Login(CreateLoginRequest(string.Empty, _registrationData.Password)));

            Assert.That(e.Exception.ErrorMessage, Is.Not.Empty);
            Assert.AreEqual(PlayerAccountResponseCode.UsernamePasswordCombinationIsNotValid.ToString(), e.Exception.ErrorCode);

            e = await AsyncTestHelper.ThrowsAsync <MemberApiProxyException>(
                () => PlayerWebservice.Login(CreateLoginRequest(_registrationData.Username, string.Empty)));

            Assert.IsNotEmpty(e.Exception.ErrorMessage);
            Assert.AreEqual(PlayerAccountResponseCode.UsernamePasswordCombinationIsNotValid.ToString(), e.Exception.ErrorCode);
        }
コード例 #4
0
ファイル: LoginTests.cs プロジェクト: singlag888/aft-regov2
        public async void Unable_to_login_after_max_failed_login_attempts()
        {
            var maxFailedLoginAttempts = Convert.ToInt32(ConfigurationManager.AppSettings["MaxFailedLoginAttempts"]);
            var newPlayer = await RegisterPlayer(false);

            var wrongLoginRequest = CreateLoginRequest(newPlayer.Username, "wrongPassword");

            for (var i = 0; i < maxFailedLoginAttempts; i++)
            {
                var passwordError = await AsyncTestHelper.ThrowsAsync <MemberApiProxyException>(
                    () => PlayerWebservice.Login(wrongLoginRequest));

                Assert.IsNotEmpty(passwordError.Exception.ErrorMessage);
                Assert.AreEqual(PlayerAccountResponseCode.UsernamePasswordCombinationIsNotValid.ToString(), passwordError.Exception.ErrorCode);
            }

            var lockedError = await AsyncTestHelper.ThrowsAsync <MemberApiProxyException>(
                () => PlayerWebservice.Login(CreateLoginRequest(newPlayer.Username, newPlayer.Password)));

            Assert.IsNotEmpty(lockedError.Exception.ErrorMessage);
            Assert.AreEqual(PlayerAccountResponseCode.AccountLocked.ToString(), lockedError.Exception.ErrorCode);
        }