public void registerUserWithProperStringValueTest() { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); try { expected = Backendless.UserService.Register(user); } catch (System.Exception e) { Assert.Fail(e.Message); } Assert.IsNotNull(expected, "Server returned a null result"); Assert.IsNotNull(expected.UserId, "Server returned a null id"); Assert.AreEqual(login, expected.Properties["login"], "Server returned wrong user login"); Assert.AreEqual("*****@*****.**", expected.Properties["email"], "Server returned wrong user email"); Assert.AreEqual("111222", expected.Password, "Server returned wrong user password"); }
public void registerUserForDisabledDynamicPropertiesTest() { try { BackendlessUser user = new BackendlessUser { }; string login = "******" + random.Next(); user.SetProperty("email", login + "@hotmail.com"); user.SetProperty("login", login); user.SetProperty("dynamic_property", "1111"); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); Assert.IsNotNull(expected, "Server returned a null result"); Assert.IsNotNull(expected.UserId, "Server returned a null id"); Assert.AreEqual(login, expected.Properties["login"], "Server returned wrong user login"); Assert.AreEqual(login + "@hotmail.com", expected.Properties["email"], "Server returned wrong user email"); Assert.AreEqual("111222", expected.Password, "Server returned wrong user password"); Assert.AreEqual("1111", expected.Properties["dynamic_property"], "Server returned wrong user dynamic_property"); } catch (BackendlessException e) { Assert.AreEqual("1232", e.Code); } }
public void registerCopyUserWithIdentityTest() { string login = "******" + random.Next(); AsyncCallback<BackendlessUser> callback1 = new AsyncCallback<BackendlessUser>( user => { Assert.IsNotNull(user, "Server returned a null result"); }, fault => { Assert.Fail(fault.Message); }); AsyncCallback<BackendlessUser> callback2 = new AsyncCallback<BackendlessUser>( user => { BackendlessUser u2 = new BackendlessUser { }; u2.SetProperty("email", "*****@*****.**"); u2.SetProperty("login", login); u2.Password = "******"; Backendless.UserService.Register(u2, callback1); }, fault => { Assert.Fail(fault.Message); }); BackendlessUser u = new BackendlessUser { }; u.SetProperty("email", "*****@*****.**"); u.SetProperty("login", login); u.Password = "******"; Backendless.UserService.Register(u,callback2); }
public void updateUserPropertiesTest() { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; try { Backendless.UserService.Register(user); BackendlessUser user2 = Backendless.UserService.Login(login, "111222"); user2.SetProperty("email", "*****@*****.**"); user2.Password = "******"; BackendlessUser user3 = Backendless.UserService.Update(user2); Assert.AreEqual("*****@*****.**", user3.Properties["email"], "Server returned wrong user email"); Assert.AreEqual("111111", user3.Password, "Server returned wrong user password"); } catch (System.Exception e) { Assert.Fail(e.Message); } }
public void getCurrentUserTest() { try { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", login + "@hotmail.com"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user); Backendless.UserService.Login(login, "111222"); Assert.AreEqual(UserService.CurrentUser.GetProperty("login").ToString(), login); } catch(BackendlessException ex) { Assert.Fail(ex.Message); } }
public void loginWithProperStringValueTest() { try { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", login + "@hotmail.com"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user); BackendlessUser expected = Backendless.UserService.Login(login, "111222"); Assert.IsNotNull(expected); } catch (BackendlessException ex) { Assert.Fail(ex.Message); } }
public void registerWithIntValueTest() { BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", 1234); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); try { expected = Backendless.UserService.Register(user); } catch (BackendlessException e) { //Wrong value type for property 'login'. Assert.AreEqual("3049", e.Code); } }
public void registerWithNullEmailTest() { try { BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", null); user.SetProperty("login", "test001"); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (BackendlessException e) { //Provided email has wrong format. Assert.AreEqual("3040", e.Code); } }
public void loginWithProperStringValueTest() { AsyncCallback<BackendlessUser> logincallback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); }, f => { Assert.Fail(f.Message); }); AsyncCallback<BackendlessUser> registercallback = new AsyncCallback<BackendlessUser>( u => { Backendless.UserService.Login(u.Properties["login"].ToString(), u.Password, logincallback); }, f => { Assert.Fail(f.Message); }); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", "test"+random.Next()); user.Password = "******"; Backendless.UserService.Register(user,registercallback); }
public void registerWithNullValueTest() { AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); }, f => { Assert.Fail(f.Message); }); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", null); user.SetProperty("login", null); user.SetProperty("password", null); Backendless.UserService.Register(user,callback); }
public void registerWithBooleanValueTest() { AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); }, f => { Assert.Fail(f.Message); }); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", true); user.SetProperty("login", true); user.SetProperty("password", "test"); try { Backendless.UserService.Register(user, callback); } catch (BackendlessException ex) { Assert.AreEqual("3040", ex.Code); } }
public void registerWithIntValueTest() { AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); }, f => { Assert.Fail(f.Message); }); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", 1234); user.Password = "******"; Backendless.UserService.Register(user,callback); }
public void registerWithNullEmailTest() { AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); }, f => { Assert.Fail(f.Message); }); string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", null); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user,callback); }
public void registerUserForDisabledDynamicPropertiesTest() { AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); }, f => { Assert.Fail(f.Message); }); string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.SetProperty("dynamic_property", "1111"); user.Password = "******"; Backendless.UserService.Register(user,callback); }
public void registerWithoutLoginAsIdentityTest() { try { BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (BackendlessException e) { Assert.AreEqual("3013", e.Code); } }
public void registerWithWrongArgumentsCountTest() { try { BackendlessUser user = new BackendlessUser { }; string login = "******" + random.Next(); user.SetProperty("email", login + "@hotmail.com"); user.SetProperty("login", login); user.SetProperty("login2", "test002"); user.SetProperty("password2", "111111"); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (System.Exception e) { Assert.Fail(e.Message); } }
public void getCurrentUserTest() { string login = "******" + random.Next(); AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.AreEqual(UserService.CurrentUser, login); }, f => { Assert.Fail(f.Message); }); AsyncCallback<BackendlessUser> regCallback = new AsyncCallback<BackendlessUser>( u => { Backendless.UserService.Login(login, "111222",callback); }, f => { Assert.Fail(f.Message); }); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user,regCallback); }
public void registerWithIntValueAndWrongEmailTest() { try { BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "test.com"); user.SetProperty("login", 1234); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (BackendlessException e) { Assert.AreEqual("3040", e.Code); } }
public void restorePasswordTest() { try { AsyncCallback<object> callback = new AsyncCallback<object>( u => { Assert.IsNotNull(u); }, f => { Assert.Fail(f.Message); }); string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser(); user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user); Backendless.UserService.RestorePassword(login, callback); } catch (BackendlessException ex) { Assert.Fail(ex.Message); } }
public void registerWithNullValueTest() { try { BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", null); user.SetProperty("login", null); user.SetProperty("password", null); BackendlessUser expected = new BackendlessUser(); expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (BackendlessException e) { Assert.AreEqual("3041", e.Code); } }
public void registerUserWithProperStringValueTest() { string login = "******" + random.Next(); AsyncCallback<BackendlessUser> callback = new AsyncCallback<BackendlessUser>( u => { Assert.IsNotNull(u, "Server returned a null result"); Assert.IsNotNull(u.UserId, "Server returned a null id"); Assert.AreEqual(login, u.Properties["login"], "Server returned wrong user login"); Assert.AreEqual("*****@*****.**", u.Properties["email"], "Server returned wrong user email"); Assert.AreEqual("111222", u.Password, "Server returned wrong user password"); }, f => { Assert.Fail(f.Message); }); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user, callback); }
public void loginUserWithInvalidPasswordTest() { try { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user); BackendlessUser expected = Backendless.UserService.Login(login, "111111"); Assert.IsNotNull(expected); } catch (BackendlessException ex) { Assert.AreEqual("3003", ex.Code); } }
public void registerUserWithoutEmailTest() { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("login", login); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); try { expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (BackendlessException ex) { Assert.AreEqual("3012", ex.Code); } Assert.IsNotNull(expected, "Server returned a null result"); }
public void restorePasswordTest() { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser(); user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; Backendless.UserService.Register(user); try { Backendless.UserService.RestorePassword(login); } catch (BackendlessException ex) { Assert.Fail(ex.Message); } }
public void registerCopyUserWithIdentityTest() { try { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", "*****@*****.**"); user.SetProperty("login", login); user.Password = "******"; BackendlessUser actual= Backendless.UserService.Register(user); BackendlessUser user2 = new BackendlessUser { }; user2.SetProperty("email", "*****@*****.**"); user2.SetProperty("login", login); user2.Password = "******"; BackendlessUser expected = Backendless.UserService.Register(user2); Assert.AreEqual(expected, actual); } catch (BackendlessException ex) { Assert.AreEqual("3033", ex.Code); } }
public void registerWithProperStringValueAndIdTest() { string login = "******" + random.Next(); BackendlessUser user = new BackendlessUser { }; user.SetProperty("email", login + "@hotmail.com"); user.SetProperty("login", login); user.SetProperty("id", "12345"); user.Password = "******"; BackendlessUser expected = new BackendlessUser(); try { expected = Backendless.UserService.Register(user); Assert.IsNotNull(expected); } catch (BackendlessException e) { Assert.AreEqual("3039", e.Code); } //Assert.IsNotNull(expected, "Server returned a null result"); //Assert.IsNotNull(expected.Id, "Server returned a null id"); //Assert.AreEqual("test001", expected.Properties["login"], "Server returned wrong user login"); //Assert.AreEqual("*****@*****.**", expected.Properties["email"], "Server returned wrong user email"); //Assert.AreEqual("12345", expected.Properties["id"], "Server returned wrong user id"); //Assert.AreEqual("111222", expected.Password, "Server returned wrong user password"); }
public ActionResult Register(RegisterModel registerModel) { if (ModelState.IsValid) { try { BackendlessUser newUser = new BackendlessUser(); newUser.SetProperty("login", registerModel.Login); newUser.SetProperty("email", registerModel.Email); newUser.SetProperty("name", registerModel.Name); newUser.SetProperty("surname", registerModel.Surname); newUser.Password = registerModel.Password; Backendless.UserService.Register(newUser); return RedirectToAction("Login", "Account"); } catch (BackendlessException exception) { if (exception.FaultCode == "3033") { ModelState.AddModelError("", "Login jest zajęty."); } else { ModelState.AddModelError("", exception.ToString()); } } } return View(registerModel); }