public void TestUpdateUserWithNullCredentials() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); GetRandomLoggedInUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = user => { user.SetProperty(LOGIN_KEY, null); user.Password = null; Backendless.UserService.Update(user, new AsyncCallback <BackendlessUser>( response => FailCountDownWith("User with null credentials accepted"), fault => CheckErrorCode(ExceptionMessage.NULL_PASSWORD, fault))); } }); }); }
public void TestUpdateUserForVersionWithDisabledDynamicPropertis() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); GetRandomLoggedInUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = user => { user.SetProperty("somePropertyKey", "somePropertyValue"); Backendless.UserService.Update(user, new AsyncCallback <BackendlessUser>( response => FailCountDownWith( "Server updated user with a dynamic property for a version with disabled dynamic properties."), fault => CheckErrorCode(3031, fault))); } }); }); }
public void TestRegisterNewUser() { 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); BackendlessUser registeredUser = Backendless.UserService.Register(user); UsedProperties.Add(propertyKey); Assert.IsNotNull(registeredUser.GetProperty("id"), "UserService.register didn't set user ID"); foreach (string key in user.Properties.Keys) { Assert.IsTrue(registeredUser.Properties.ContainsKey(key), "Registered user didn`t contain expected property " + key); Assert.AreEqual(user.GetProperty(key), registeredUser.GetProperty(key), "UserService.register changed property " + key); } }
public void TestUpdateUserForVersionWithEnabledDynamicPropertis() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); BackendlessUser user = GetRandomLoggedInUser(); 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); Backendless.UserService.Login(user.Email, user.Password); UsedProperties.Add(propertyKey); List <UserProperty> userProperties = Backendless.UserService.DescribeUserClass(); 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"); }
public void TestDescribeUserProperties() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); BackendlessUser user = GetRandomNotRegisteredUser(); string propertyKeySync = "property_key_Sync"; user.SetProperty(propertyKeySync, "porperty_value_" + Random.Next()); Backendless.UserService.Register(user); Backendless.UserService.Login((string)user.Email, 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, ID_KEY, LOGIN_KEY, PASSWORD_KEY, EMAIL_KEY }; foreach (UserProperty userProperty in userProperties) { Assert.IsNotNull(userProperty, "User property was null"); Assert.IsNotNull(userProperty.Type, "User properties type was null"); } foreach (string property in properties) { bool isFind = false; foreach (UserProperty userProperty in userProperties) { if (userProperty.Name.Equals(property) == true) { isFind = true; break; } } Assert.IsTrue(isFind, "User properties contained unexpected property " + property); } }
public void TestLoginWithoutFailedLoginsLock() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); BackendlessUser user = GetRandomRegisteredUser(); try { Backendless.UserService.Login((string)user.Email, user.Password + "foo"); } catch (System.Exception /* t */) { } try { Backendless.UserService.Login((string)user.Email, user.Password); } catch (System.Exception t) { Assert.Fail(t.Message); } }
public void TestLoginWithoutFailedLoginsLock() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); GetRandomRegisteredUser(new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => Backendless.UserService.Login((string)response.Email, response.Password + "foo", new AsyncCallback <BackendlessUser>( user => FailCountDownWith("Server didn't locked login"), fault => { Backendless.UserService.Login( (string)response.Email, response.Password, new ResponseCallback <BackendlessUser>(this) { ResponseHandler = user => CountDown() }); })) }); }); }
public void TestRegisterNewUserWithEmptyCredentials() { RunAndAwait(() => { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); BackendlessUser user = new BackendlessUser(); user.SetProperty(LOGIN_KEY, ""); user.SetProperty(EMAIL_KEY, ""); user.Password = ""; user.SetProperty("", "foo"); user.SetProperty("foo", ""); Backendless.UserService.Register(user, new ResponseCallback <BackendlessUser>(this) { ResponseHandler = response => FailCountDownWith("BackendlessUser accepted empty values"), ErrorHandler = fault => { Assert.IsTrue(fault.ToString().Contains("Value cannot be null")); CountDown(); } }); }); }
public void SetUp() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION); }
public void SetUp() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); definedCategories.Clear(); definedCategory = null; }
void Awake() { // This is needed so that the Unity client cannot connect to Backendless RT // Also, it is needed on Android, so it can communicate via HTTPS ServicePointManager.ServerCertificateValidationCallback = (p1, p2, p3, p4) => true; DontDestroyOnLoad(this); if (_instance == null) { _instance = this; } else { DestroyImmediate(this.gameObject); // avoid duplicate BackendlessPlugin GameObjects return; } Backendless.URL = "https://api.backendless.com"; // This redirects any logging inside of the Backendless SDK into Unity's Debug.log Weborb.Util.Logging.Log.addLogger("unitylogger", new BackendlessPlugin.UnityLogger()); // Initialize Backendless Backendless.InitApp(applicationId, APIKey); // Default network timeout (this must be set after Backendless.InitApp) Backendless.Timeout = 30000; // 30 secs // Backendless.Data.MapTableToType("Devices", typeof(/* type of a class that models one of your tables on Backendless and inherits Backendless Entity */)); #if ENABLE_PUSH_PLUGIN Backendless.Messaging.SetUnityRegisterDevice(UnityRegisterDevice, UnityUnregisterDevice); #if UNITY_ANDROID && !UNITY_EDITOR AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); activity = jc.GetStatic <AndroidJavaObject>("currentActivity"); activity.Call("setUnityGameObject", this.gameObject.name); #elif (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR setListenerGameObject(this.gameObject.name); #endif #endif #if UNITY_IOS || UNITY_TVOS || UNITY_ANDROID /* In order to use the .NET SDK we needed some hardcoded logic here to make sure some of its code was properly compiled for AOT on iOS. * We'd get errors like the following when trying to delete the a record from a table. * * Error: Code = , Message = Attempting to call method 'Weborb.Client.HttpEngine::SendRequest<System.Int64>' for which no ahead of time (AOT) code was generated., Detail = * UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object) * UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[]) * UnityEngine.Logger:Log(LogType, Object) * UnityEngine.Debug:LogError(Object) * <FinalizeSellItem>c__AnonStoreyA5:<>m__C1(BackendlessFault) * BackendlessAPI.Async.ErrorHandler:Invoke(BackendlessFault) * BackendlessAPI.Engine.Invoker:InvokeAsync(String, String, Object[], Boolean, AsyncCallback`1) * BackendlessAPI.Engine.Invoker:InvokeAsync(String, String, Object[], AsyncCallback`1) * BackendlessAPI.Service.PersistenceService:Remove(T, AsyncCallback`1) * BackendlessAPI.Data.DataStoreImpl`1:Remove(T, AsyncCallback`1) * <FinalizeSellItem>c__AnonStoreyA5:<>m__BF() * System.Action:Invoke() * Loom:Update() */ try { IdInfo idInfo = new IdInfo(); HttpEngine httpEngine = new Weborb.Client.HttpEngine("http://api.backendless.com", idInfo); httpEngine.SendRequest <Boolean>(null, null, null, null, null); httpEngine.SendRequest <Int64>(null, null, null, null, null); } catch (Exception e) { // ignore } #endif }
public void TestUserServiceInitialized() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); }
public void TestCurrentUserIsEmpty() { Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); Assert.IsTrue(Backendless.UserService.CurrentUser == null, "Current user was not empty"); }
public BackendlessDataSource() { Backendless.InitApp(Settings.BackendlessAPPID, Settings.BackendlessAPIKEY); }
public static void AssemblyInit_SetupDatabaseData(TestContext context) { Backendless.URL = BKNDLSS_URL; Backendless.InitApp(APP_API_KEY, DOTNET_API_KEY); }
public void SetUp() { Backendless.URL = "http://" + Defaults.BACKENDLESS_HOST + ":9000"; Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY); }