public void TestRegisterNewUserWithId() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); Backendless.UserService.Register(GetRandomNotRegisteredUser(), new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => { BackendlessUser fakeUser = GetRandomNotRegisteredUser(); fakeUser.UserId = response.UserId; Backendless.UserService.Register(fakeUser, new ResponseCallback <BackendlessUser>( this) { ResponseHandler = user => FailCountDownWith( "Server accepted a user with id value"), ErrorHandler = fault => CheckErrorCode(3039, fault) }); } }); }); }
public void TestRestoreUserPassword() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomLoggedInUser(); Backendless.UserService.RestorePassword((string)user.GetProperty(LOGIN_KEY)); }
void Awake() { DontDestroyOnLoad(this); #if UNITY_WEBPLAYER #error WEBPLAYER PROXY IMPLEMENT Backendless.setUrl(""); string proxyIp = ""; int proxyPort = 0; Security.PrefetchSocketPolicy(proxyIp, proxyPort); #else if (Server == SERVER.GMO_MBAAS) { Backendless.setUrl("https://api.gmo-mbaas.com"); } else { Backendless.setUrl("https://api.backendless.com"); } #endif Backendless.InitApp(applicationId, RestSecretKey, version); #if ENABLE_PUSH_PLUGIN Backendless.Messaging.SetUnityRegisterDevice(UnityRegisterDevice, UnityUnregisterDevice); #if UNITY_ANDROID AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); activity = jc.GetStatic <AndroidJavaObject>("currentActivity"); activity.Call("setUnityGameObject", this.gameObject.name); #elif UNITY_IPHONE setListenerGameObject(this.gameObject.name); #endif #endif }
public void TestRegisterNewUser() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomNotRegisteredUser(); string propertyKey = "property_key#" + Random.Next(); string propertyValue = "property_value#" + Random.Next(); user.SetProperty(propertyKey, propertyValue); Backendless.UserService.Register(user, new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => { UsedProperties.Add(propertyKey); Assert.IsNotNull(response.GetProperty("id"), "UserService.register didn't set user ID"); foreach (String key in user.Properties.Keys) { Assert.IsTrue(response.Properties.ContainsKey(key), "Registered user didn`t contain expected property " + key); Assert.AreEqual(user.GetProperty(key), response.GetProperty(key), "UserService.register changed property " + key); } CountDown(); } }); }); }
void MainPage_Loaded(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(Defaults.APPLICATION_ID) || string.IsNullOrEmpty(Defaults.SECRET_KEY) || string.IsNullOrEmpty(Defaults.VERSION)) { NavigationService.Navigate(new Uri("/ErrorPage.xaml", UriKind.Relative)); return; } Backendless.InitApp(Defaults.APPLICATION_ID, Defaults.SECRET_KEY, Defaults.VERSION); DataStore = Backendless.Persistence.Of <ToDoEntity>(); EntitiesDataGrid.DataContext = _toDoList; _toDoList.CollectionChanged += (senderObj, args) => Footer.Visibility = _toDoList.Count == 0 ? Visibility.Collapsed : Visibility.Visible; AsyncStartedEvent += () => { ProgressBar.Visibility = Visibility.Visible; ContentPanel.Opacity = 0.1; }; AsyncFinishedEvent += () => { ProgressBar.Visibility = Visibility.Collapsed; ContentPanel.Opacity = 1; }; AsyncStartedEvent.Invoke(); DataStore.Find(new AsyncCallback <BackendlessCollection <ToDoEntity> >(response => Dispatcher.BeginInvoke(() => { _toDoList.AddAll(response.GetCurrentPage()); AsyncFinishedEvent.Invoke(); }), fault => Dispatcher.BeginInvoke(() => AsyncFinishedEvent.Invoke()))); }
public void TestRegisterNewUserWithDuplicateIdentity() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); Backendless.UserService.Register(GetRandomNotRegisteredUser(), new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => { BackendlessUser fakeUser = GetRandomNotRegisteredUser(); fakeUser.SetProperty(LOGIN_KEY, response.GetProperty(LOGIN_KEY)); Backendless.UserService.Register(fakeUser, new ResponseCallback <BackendlessUser>( this) { ResponseHandler = user => FailCountDownWith( "Server accepted a user with id value"), ErrorHandler = fault => CheckErrorCode(3033, fault) }); } }); }); }
public void TestDescribeUserProperties() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomNotRegisteredUser(); string propertyKeySync = "property_key#Sync"; string propertyKeyAsync = "property_key#Async"; user.SetProperty(propertyKeySync, "porperty_value#" + Random.Next()); Backendless.UserService.Register(user); Backendless.UserService.Login((string)user.GetProperty(LOGIN_KEY), user.Password); List <UserProperty> userProperties = Backendless.UserService.DescribeUserClass(); Assert.IsNotNull(userProperties, "Server returned null user properties"); Assert.IsTrue(userProperties.Count != 0, "Server returned empty user properties"); var properties = new List <string> { propertyKeySync, propertyKeyAsync, ID_KEY, LOGIN_KEY, PASSWORD_KEY, EMAIL_KEY }; foreach (UserProperty userProperty in userProperties) { Assert.IsNotNull(userProperty, "User property was null"); Assert.IsTrue(properties.Contains(userProperty.Name), "User properties contained unexpected property " + userProperty.Name); Assert.IsNotNull(userProperty.Type, "User properties type was null"); } }
public void TestUpdateRegisteredUserEmailAndPassword() { RunAndAwait(() => { string newpassword = "******"; string newemail = "*****@*****.**"; Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); GetRandomLoggedInUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = user => { user.Password = newpassword; user.SetProperty(EMAIL_KEY, newemail); Backendless.UserService.Update(user, new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => { Assert.AreEqual(newpassword, user.Password, "Updated used has a wrong password"); Assert.AreEqual(newemail, user.GetProperty(EMAIL_KEY), "Updated used has a wrong email"); CountDown(); } }); } }); }); }
public void TestUpdateUserForVersionWithEnabledDynamicPropertis() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); GetRandomLoggedInUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = user => { string propertyKey = "somePropertyKey" + Random.Next(); string propertyValue = "somePropertyValue" + Random.Next(); user.SetProperty(propertyKey, propertyValue); foreach (String usedProperty in UsedProperties) { user.SetProperty(usedProperty, "someValue"); } Backendless.UserService.Update(user, new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => { UsedProperties.Add(propertyKey); Backendless.UserService.Login(response.Email, response.Password); Backendless.UserService.DescribeUserClass( new ResponseCallback <List <UserProperty> >(this) { ResponseHandler = userProperties => { Assert.IsNotNull(userProperties, "Server returned null user properties"); Assert.IsTrue(userProperties.Count != 0, "Server returned empty user properties"); bool flag = false; foreach (UserProperty userProperty in userProperties) { if (userProperty.Name.Equals(propertyKey)) { flag = true; Assert.IsTrue( userProperty.Type.Equals(DateTypeEnum.STRING), "Property had wrong type"); } } Assert.IsTrue(flag, "Expected property was not found"); CountDown(); } }); } }); } }); }); }
public void TestUserLogout() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomLoggedInUser(); Backendless.UserService.Logout(); Assert.IsTrue(Backendless.UserService.CurrentUser == null, "Current user was not empty"); }
public void TestUpdateRegisteredUserIdentity() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomLoggedInUser(); user.SetProperty(LOGIN_KEY, "some_new_login_" + user.GetProperty(LOGIN_KEY)); Backendless.UserService.Update(user); }
public void SetUp() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); messageStatus = null; latch = null; message = null; publisher = null; headers = null; testResult = null; }
void MainPage_Loaded(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(Defaults.APPLICATION_ID) || string.IsNullOrEmpty(Defaults.SECRET_KEY) || string.IsNullOrEmpty(Defaults.VERSION)) { NavigationService.Navigate(new Uri("/ErrorPage.xaml", UriKind.Relative)); return; } Backendless.InitApp(Defaults.APPLICATION_ID, Defaults.SECRET_KEY, Defaults.VERSION); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); Backendless.InitApp("89076717-7C81-9CCB-FF27-212BF1C56C00", "89F7667F-FDD9-4668-FFE1-831793BDB000", "v1"); }
public void TestRegisterNewUserFromNull() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); Backendless.UserService.Register(null); Assert.Fail("UserService accepted a null user"); } catch (System.Exception t) { CheckErrorCode(ExceptionMessage.NULL_USER, t); } }
public void TestUpdateRegisteredUserIdentity() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); GetRandomLoggedInUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = user => { user.SetProperty(LOGIN_KEY, "some_new_login_" + user.GetProperty(LOGIN_KEY)); Backendless.UserService.Update(user, new ResponseCallback <BackendlessUser>(this)); } }); }
public void TestLoginWithNullPassword() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); Backendless.UserService.Login((string)GetRandomRegisteredUser().Email, null); Assert.Fail("UserService accepted null password"); } catch (System.Exception t) { CheckErrorCode(BackendlessAPI.Exception.ExceptionMessage.NULL_PASSWORD, t); } }
public void TestRegisterNewUserFromEmptyUser() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); Backendless.UserService.Register(new BackendlessUser()); Assert.Fail("UserService accepted a null user"); } catch (System.Exception t) { CheckErrorCode(ExceptionMessage.NULL_PASSWORD, t); } }
public void TestRestoreUserPassword() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); GetRandomRegisteredUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => Backendless.UserService.RestorePassword((string)response.Email, new ResponseCallback <object>(this)) }); }); }
public void TestLoginWithProperCredentials() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); BackendlessUser user = GetRandomRegisteredUser(); Backendless.UserService.Login((string)user.Email, user.Password); Backendless.UserService.DescribeUserClass(); } catch (System.Exception t) { Assert.Fail(t.Message); } }
public void TestRestoreUserPassword() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); GetRandomLoggedInUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => Backendless.UserService.RestorePassword((string)response.GetProperty(LOGIN_KEY), new ResponseCallback <object>(this)) }); }); }
public void TestLoginWithNullLogin() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); Backendless.UserService.Login(null, GetRandomRegisteredUser().Password); Backendless.UserService.Logout(); Assert.Fail("UserService accepted null Login"); } catch (System.Exception t) { CheckErrorCode(Exception.ExceptionMessage.NULL_LOGIN, t); } }
private void InitApi() { String appId = "A3D96FA2-7314-2543-FF66-0B60549D7300"; String secretKey = "97ABCC00-2E19-E4F9-FFCA-B3721842F100"; Backendless.URL = "http://api.backendless.com"; try { Backendless.InitApp(appId, secretKey); } catch (Exception e) { } }
public void TestRestoreUserPasswordWithWrongLogin() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); BackendlessUser user = GetRandomLoggedInUser(); Backendless.UserService.RestorePassword("fake_login_" + user.Email); Assert.Fail("Server accepted wrong login."); } catch (System.Exception t) { CheckErrorCode(3020, t); } }
public void TestLoginWithWrongCredentials() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); var user = GetRandomRegisteredUser(); Backendless.UserService.Login(user.Email + "foobar", user.Password + "foobar"); Assert.Fail("Server accepted wrong credentials"); } catch (System.Exception t) { CheckErrorCode(3003, t); } }
public void TestRegisterNewUserAtAppWithDisabledRegistration() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); Backendless.UserService.Register(GetRandomNotRegisteredUser()); Assert.Fail("Server accepted registration for an application with disabled registration"); } catch (System.Exception t) { CheckErrorCode(3009, t); } }
private void InitApi() { String appId = "9BA31C05-1D39-4DE3-FF50-38EED1144E00"; String secretKey = "2BC1BACF-E7BC-7EDD-FF99-41B49CF02700"; Backendless.URL = "http://api.backendless.com"; try { Backendless.InitApp(appId, secretKey); } catch (Exception e) { Console.Write($"Error {e.Message}"); } }
public void TestUpdateUserWithWrongUserId() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomLoggedInUser(); user.SetProperty("id", "foobar"); Backendless.UserService.Update(user); Assert.Fail("User with wrong id accepted"); } catch (BackendlessException t) { CheckErrorCode(3029, t); } }
public void TestUpdateUserWithEmptyUserId() { try { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomLoggedInUser(); user.SetProperty("id", ""); Backendless.UserService.Update(user); Assert.Fail("User with empty id accepted"); } catch (System.Exception t) { CheckErrorCode(ExceptionMessage.WRONG_USER_ID, t); } }
public void TestUpdateRegisteredUserEmailAndPassword() { const string newpassword = "******"; const string newemail = "*****@*****.**"; Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = GetRandomLoggedInUser(); user.Password = newpassword; user.SetProperty(EMAIL_KEY, newemail); Backendless.UserService.Update(user); Assert.AreEqual(newpassword, user.Password, "Updated used has a wrong password"); Assert.AreEqual(newemail, user.GetProperty(EMAIL_KEY), "Updated used has a wrong email"); }