public async void Can_get_player_profile() { // Arrange await PlayerWebservice.Login(new LoginRequest { Username = _registrationData.Username, Password = _registrationData.Password, BrandId = new Guid("00000000-0000-0000-0000-000000000138"), IPAddress = "::1", RequestHeaders = new Dictionary <string, string>() }); // Act var result = await PlayerWebservice.ProfileAsync(); // Assert Assert.AreEqual(_registrationData.IpAddress, result.IpAddress); Assert.AreEqual(_registrationData.DomainName, result.DomainName); Assert.AreEqual(_registrationData.Username, result.Username); Assert.AreEqual(_registrationData.FirstName, result.FirstName); Assert.AreEqual(_registrationData.LastName, result.LastName); Assert.AreEqual(_registrationData.MailingAddressLine1, result.MailingAddressLine1); Assert.AreEqual(_registrationData.MailingAddressPostalCode, result.MailingAddressPostalCode); Assert.AreEqual(_registrationData.CountryCode, result.CountryCode); Assert.AreEqual(_registrationData.CurrencyCode, result.CurrencyCode); Assert.AreEqual(_registrationData.Email, result.Email); Assert.AreEqual(_registrationData.PhoneNumber, result.PhoneNumber); Assert.AreEqual(_registrationData.DateOfBirth, result.DateOfBirth.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture)); }
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); }
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())); }
public async void No_phone_numbers_validation_works() { await PlayerWebservice.Login(CreateLoginRequest (_registrationData.Username, _registrationData.Password )); var e = Assert.Throws <MemberApiValidationException>(async() => await PlayerWebservice.ReferFriendsAsync(new ReferFriendsRequest())); Assert.AreEqual(ReferalDataValidatorResponseCodes.PhoneNumbersAreMissing.ToString(), e.Message); }
public async void Can_refer_friends() { await PlayerWebservice.Login(CreateLoginRequest (_registrationData.Username, _registrationData.Password )); var response = PlayerWebservice.ReferFriendsAsync(new ReferFriendsRequest { PhoneNumbers = new List <string> { "12345678" } }); }
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); }
protected async Task <RegisterRequest> RegisterPlayer(bool doLogin = true) { var registrationData = TestDataGenerator.CreateRandomRegistrationRequestData(); await PlayerWebservice.RegisterAsync(registrationData); if (doLogin) { await PlayerWebservice.Login(new LoginRequest { Username = registrationData.Username, Password = registrationData.Password, BrandId = new Guid("00000000-0000-0000-0000-000000000138"), IPAddress = registrationData.IpAddress, RequestHeaders = new Dictionary <string, string>() }); } return(registrationData); }
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); }
public void Can_login_Player() { var result = PlayerWebservice.Login(CreateLoginRequest(_registrationData.Username, _registrationData.Password)); }