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));
 }
        public ActionResult UserProfile(UserProfileModel userProfileModel)
        {
            BackendlessUser user = Backendless.UserService.CurrentUser;

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (ModelState.IsValid)
            {
                try
                {
                    string loggedInUserName = (string)user.Properties["login"];
                    Backendless.UserService.Login(loggedInUserName, userProfileModel.OldPassword);
                    user.Password = userProfileModel.NewPassword;
                    user.SetProperty("name", userProfileModel.Name);
                    user.SetProperty("surname", userProfileModel.Surname);
                    user.SetProperty("email", userProfileModel.Email);
                    Backendless.UserService.Update(user);
                    ModelState.AddModelError("", "Zaktualizowano dane użytkownika.");
                }
                catch (BackendlessException exception)
                {
                    if (exception.FaultCode == "3003")
                    {
                        ModelState.AddModelError("", "Błędne hasło użytkownika.");
                    }
                    else
                    {
                        ModelState.AddModelError("", exception.ToString());
                    }
                }
            }
            return(View(userProfileModel));
        }
Exemplo n.º 3
0
    public BackendlessUser GetRandomNotRegisteredUser()
    {
      var timestamp = (DateTime.UtcNow.Ticks + Random.Next()).ToString();
      BackendlessUser result = new BackendlessUser();
      result.SetProperty( LOGIN_KEY, "bot" + timestamp );
      result.SetProperty( EMAIL_KEY, result.GetProperty( LOGIN_KEY ) + "@gmail.com" );
      result.Password = "******" + timestamp;

      return result;
    }
Exemplo n.º 4
0
        public BackendlessUser GetRandomNotRegisteredUser()
        {
            var timestamp = (DateTime.UtcNow.Ticks + Random.Next()).ToString();
            var result    = new BackendlessUser();

            result.SetProperty(LOGIN_KEY, "bot" + timestamp);
            result.SetProperty(EMAIL_KEY, result.GetProperty(LOGIN_KEY) + "@gmail.com");
            result.Password = "******" + timestamp;

            return(result);
        }
Exemplo n.º 5
0
        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();
                    }
                });
            });
        }
Exemplo n.º 6
0
        public void TestRegisterNewUserWithId()
        {
            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(ID_KEY, response.GetProperty(ID_KEY));

                        Backendless.UserService.Register(fakeUser,
                                                         new ResponseCallback <BackendlessUser>(
                                                             this)
                        {
                            ResponseHandler =
                                user =>
                                FailCountDownWith(
                                    "Server accepted a user with id value"),
                            ErrorHandler =
                                fault =>
                                CheckErrorCode(3039, fault)
                        });
                    }
                });
            });
        }
Exemplo n.º 7
0
        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");
            }
        }
Exemplo n.º 8
0
        public void TestCurrentUserAfterLogin()
        {
            try
            {
                BackendlessUser notRegisteredUseruser = GetRandomNotRegisteredUser();
                string          propertyKey           = "propertykey" + Random.Next();
                string          propertyValue         = "property_value#" + Random.Next();
                notRegisteredUseruser.SetProperty(propertyKey, propertyValue);

                BackendlessUser user = Backendless.UserService.Register(notRegisteredUseruser);
                UsedProperties.Add(propertyKey);

                user = Backendless.UserService.Login((string)user.GetProperty(LOGIN_KEY), user.Password);

                Assert.IsNotNull(Backendless.UserService.CurrentUser, "Current user was null");

                foreach (string key in user.Properties.Keys)
                {
                    if (key.Equals("password"))
                    {
                        continue;
                    }

                    Assert.IsTrue(Backendless.UserService.CurrentUser.Properties.ContainsKey(key), "Current user didn`t contain expected property " + key);
                    Assert.AreEqual(user.GetProperty(key), Backendless.UserService.CurrentUser.GetProperty(key), "UserService.register changed property " + key);
                }
            }
            catch (System.Exception t)
            {
                Assert.Fail(t.Message);
            }
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
    public void TestRegisterNewUserWithPartialFields()
    {
      try
      {
        Backendless.InitApp( Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, "v5" );

        BackendlessUser partialUser = new BackendlessUser();
        String login = "******" + Random.Next();
        partialUser.SetProperty( LOGIN_KEY, login );
        partialUser.SetProperty( EMAIL_KEY, login + "@gmail.com" );
        partialUser.Password = "******";
        Backendless.UserService.Register( partialUser );
        Assert.Fail( "UserService accepted a user without required fields" );
      }
      catch( System.Exception t )
      {
        CheckErrorCode( 3012, t );
      }
    }
Exemplo n.º 11
0
    public void TestRegisterNewUserWithNulls()
    {
      try
      {
        Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION);
        BackendlessUser user = new BackendlessUser();
        user.SetProperty(LOGIN_KEY, null);
        user.SetProperty(EMAIL_KEY, null);
        user.Password = null;
        user.SetProperty(null, "foo");
        user.SetProperty("foo", null);

        Backendless.UserService.Register(user);
        Assert.Fail("UserService accepted null values");
      }
      catch( ArgumentNullException )
      {
      }
    }
Exemplo n.º 12
0
        public void TestRegisterNewUserWithNulls()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = new BackendlessUser();
                user.SetProperty(LOGIN_KEY, null);
                user.SetProperty(EMAIL_KEY, null);
                user.Password = null;
                user.SetProperty(null, "foo");
                user.SetProperty("foo", null);

                Backendless.UserService.Register(user);
                Assert.Fail("UserService accepted null values");
            }
            catch (ArgumentNullException)
            {
            }
        }
Exemplo n.º 13
0
 public void TestRegisterNewUserWithNulls()
 {
   RunAndAwait( () =>
     {
       Backendless.InitApp( Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION );
       BackendlessUser user = new BackendlessUser();
       user.SetProperty( LOGIN_KEY, null );
       user.SetProperty( EMAIL_KEY, null );
       user.Password = null;
       user.SetProperty( null, "foo" );
       user.SetProperty( "foo", null );
       Backendless.UserService.Register( user,
                                         new ResponseCallback<BackendlessUser>( this )
                                           {
                                             ResponseHandler =
                                               response => FailCountDownWith( "UserService accepted null values" )
                                           } );
     } );
 }
Exemplo n.º 14
0
        public void TestRegisterNewUserWithPartialFields()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);

                BackendlessUser partialUser = new BackendlessUser();
                String          login       = "******" + Random.Next();
                partialUser.SetProperty(LOGIN_KEY, login);
                partialUser.SetProperty(EMAIL_KEY, login + "@gmail.com");
                partialUser.Password = "******";
                Backendless.UserService.Register(partialUser);
                Assert.Fail("UserService accepted a user without required fields");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3012, t);
            }
        }
Exemplo n.º 15
0
        public void TestRegisterNewUserWithEmptyCredentials()
        {
            try
            {
                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);
                Assert.Fail("BackendlessUser accepted empty values");
            }
            catch (ArgumentNullException)
            {
            }
        }
Exemplo n.º 16
0
 public void TestRegisterNewUserWithNulls()
 {
     RunAndAwait(() =>
     {
         Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
         BackendlessUser user = new BackendlessUser();
         user.SetProperty(LOGIN_KEY, null);
         user.SetProperty(EMAIL_KEY, null);
         user.Password = null;
         user.SetProperty(null, "foo");
         user.SetProperty("foo", null);
         Backendless.UserService.Register(user,
                                          new ResponseCallback <BackendlessUser>(this)
         {
             ResponseHandler =
                 response => FailCountDownWith("UserService accepted null values")
         });
     });
 }
Exemplo n.º 17
0
 public void TestRegisterNewUserWithPartialFields()
 {
   RunAndAwait( () =>
     {
       Backendless.InitApp( Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, "v5" );
       BackendlessUser partialUser = new BackendlessUser();
       String login = "******" + Random.Next();
       partialUser.SetProperty( LOGIN_KEY, login );
       partialUser.SetProperty( EMAIL_KEY, login + "@gmail.com" );
       partialUser.Password = "******";
       Backendless.UserService.Register( partialUser,
                                         new ResponseCallback<BackendlessUser>( this )
                                           {
                                             ResponseHandler =
                                               response =>
                                               FailCountDownWith( "UserService accepted a user without required fields" ),
                                             ErrorHandler = fault => CheckErrorCode( 3012, fault )
                                           } );
     } );
 }
Exemplo n.º 18
0
 public void TestRegisterNewUserWithPartialFields()
 {
     RunAndAwait(() =>
     {
         Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
         BackendlessUser partialUser = new BackendlessUser();
         String login = "******" + Random.Next();
         partialUser.SetProperty(LOGIN_KEY, login);
         partialUser.SetProperty(EMAIL_KEY, login + "@gmail.com");
         partialUser.Password = "******";
         Backendless.UserService.Register(partialUser,
                                          new ResponseCallback <BackendlessUser>(this)
         {
             ResponseHandler =
                 response =>
                 FailCountDownWith("UserService accepted a user without required fields"),
             ErrorHandler = fault => CheckErrorCode(3012, fault)
         });
     });
 }
Exemplo n.º 19
0
        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");
        }
Exemplo n.º 20
0
 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();
             }
         });
     });
 }
Exemplo n.º 21
0
        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);
            }
        }
Exemplo n.º 22
0
        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");
        }
Exemplo n.º 23
0
        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);
            }
        }
Exemplo n.º 24
0
        public void TestCurrentUserAfterLogin()
        {
            RunAndAwait(() =>
            {
                BackendlessUser notRegisteredUseruser = GetRandomNotRegisteredUser();
                string propertyKey   = "propertykey" + Random.Next();
                string propertyValue = "property_value#" + Random.Next();
                notRegisteredUseruser.SetProperty(propertyKey, propertyValue);

                Backendless.UserService.Register(notRegisteredUseruser,
                                                 new ResponseCallback <BackendlessUser>(this)
                {
                    ResponseHandler = response =>
                    {
                        UsedProperties.Add(propertyKey);
                        Backendless.UserService.Login(
                            (string)response.GetProperty(LOGIN_KEY), response.Password,
                            new ResponseCallback <BackendlessUser>(this)
                        {
                            ResponseHandler = user =>
                            {
                                Assert.IsNotNull(Backendless.UserService.CurrentUser,
                                                 "Current user was null");
                                foreach (string key in user.Properties.Keys)
                                {
                                    if (key.Equals("password"))
                                    {
                                        continue;
                                    }

                                    Assert.IsTrue(
                                        Backendless.UserService.CurrentUser.Properties.ContainsKey(
                                            key),
                                        "Current user didn`t contain expected property " + key);
                                    Assert.AreEqual(user.GetProperty(key),
                                                    Backendless.UserService.CurrentUser
                                                    .GetProperty(key),
                                                    "UserService.register changed property " +
                                                    key);
                                }
                                CountDown();
                            }
                        });
                    }
                });
            });
        }
Exemplo n.º 25
0
        public void TestRegisterNewUserAtAppWithDisabledDynamicProperties()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = GetRandomNotRegisteredUser();
                user.SetProperty("somedynamicpropertykey", "somedynamicpropertyvalue");

                Backendless.UserService.Register(user);

                Assert.Fail("BackendlessUser accepted registration for an application with disabled dynamic properties");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3010, t);
            }
        }
Exemplo n.º 26
0
        public void TestUpdateUserWithEmptyCredentials()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION);
                BackendlessUser user = GetRandomLoggedInUser();
                user.SetProperty(EMAIL_KEY, "");
                user.Password = "";

                Backendless.UserService.Update(user);
                Assert.Fail("User with empty credentials accepted");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3045, t);
            }
        }
Exemplo n.º 27
0
 public void TestRegisterNewUserWithNullPropertyValue()
 {
     RunAndAwait(() =>
     {
         Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
         BackendlessUser user = GetRandomNotRegisteredUser();
         user.SetProperty("gender", null);
         Backendless.UserService.Register(user,
                                          new ResponseCallback <BackendlessUser>(this)
         {
             ResponseHandler =
                 response =>
                 FailCountDownWith("UserService accepted null value for a property"),
             ErrorHandler = fault => CheckErrorCode(3041, fault)
         });
     });
 }
Exemplo n.º 28
0
        public void TestUpdateUserForVersionWithDisabledDynamicPropertis()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = GetRandomLoggedInUser();
                user.SetProperty("somePropertyKey", "somePropertyValue");

                Backendless.UserService.Update(user);

                Assert.Fail("Server updated user with a dynamic property for a version with disabled dynamic properties.");
            }
            catch (BackendlessException t)
            {
                CheckErrorCode(3031, t);
            }
        }
Exemplo n.º 29
0
        public void TestUpdateUserWithNullCredentials()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = GetRandomLoggedInUser();
                user.SetProperty(LOGIN_KEY, null);
                user.Password = null;

                Backendless.UserService.Update(user);
                Assert.Fail("User with null credentials accepted");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(ExceptionMessage.NULL_PASSWORD, t);
            }
        }
Exemplo n.º 30
0
        public void TestRegisterNewUserWithNullPropertyValue()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = GetRandomNotRegisteredUser();
                user.SetProperty("gender", null);

                Backendless.UserService.Register(user);

                Assert.Fail("UserService accepted null value for a property");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3041, t);
            }
        }
Exemplo n.º 31
0
        public void TestRegisterNewUserWithId()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = Backendless.UserService.Register(GetRandomNotRegisteredUser());

                BackendlessUser fakeUser = GetRandomNotRegisteredUser();
                fakeUser.SetProperty(ID_KEY, user.GetProperty(ID_KEY));

                Backendless.UserService.Register(fakeUser);
                Assert.Fail("Server accepted a user with id value");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3039, t);
            }
        }
Exemplo n.º 32
0
        public void TestUpdateUserWithNullUserId()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = GetRandomLoggedInUser();
                user.SetProperty(ID_KEY, null);

                Backendless.UserService.Update(user);
                Assert.Fail("User with null id accepted");
            }
            catch (ArgumentNullException)
            {
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3029, t);
            }
        }
Exemplo n.º 33
0
        public void TestRegisterNewUserAtAppWithDisabledDynamicProperties()
        {
            RunAndAwait(() =>
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                BackendlessUser user = GetRandomNotRegisteredUser();
                user.SetProperty("somedynamicpropertykey", "somedynamicpropertyvalue");

                Backendless.UserService.Register(user,
                                                 new ResponseCallback <BackendlessUser>(this)
                {
                    ResponseHandler =
                        response =>
                        FailCountDownWith(
                            "BackendlessUser accepted registration for an application with disabled dynamic properties"),
                    ErrorHandler = fault => CheckErrorCode(3010, fault)
                });
            });
        }
Exemplo n.º 34
0
        public void TestRegisterNewUserWithoutIdentity()
        {
            RunAndAwait(() =>
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                String timestamp     = DateTime.Now.Ticks.ToString();
                BackendlessUser user = new BackendlessUser();
                user.SetProperty(EMAIL_KEY, "bot" + timestamp + "@gmail.com");
                user.Password = "******" + timestamp;

                Backendless.UserService.Register(user,
                                                 new ResponseCallback <BackendlessUser>(this)
                {
                    ResponseHandler =
                        response => FailCountDownWith("Server accepted user without identity"),
                    ErrorHandler = fault => CheckErrorCode(3013, fault)
                });
            });
        }
Exemplo n.º 35
0
        public void TestRegisterNewUserWithoutIdentity()
        {
            try
            {
                Backendless.InitApp(Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY);
                String          timestamp = DateTime.Now.Ticks.ToString();
                BackendlessUser user      = new BackendlessUser();
                user.SetProperty(EMAIL_KEY, "bot" + timestamp + "@gmail.com");
                user.Password = "******" + timestamp;

                Backendless.UserService.Register(user);

                Assert.Fail("Server accepted user without identity");
            }
            catch (System.Exception t)
            {
                CheckErrorCode(3013, t);
            }
        }
Exemplo n.º 36
0
 public void TestRegisterNewUserWithEmptyCredentials()
 {
     RunAndAwait( () =>
     {
       Backendless.InitApp( Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION );
       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();
                                         }
                                       } );
     } );
 }
Exemplo n.º 37
0
    public void TestRegisterNewUserWithoutIdentity()
    {
      RunAndAwait( () =>
        {
          Backendless.InitApp( Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION );
          String timestamp = DateTime.Now.Ticks.ToString();
          BackendlessUser user = new BackendlessUser();
          user.SetProperty( EMAIL_KEY, "bot" + timestamp + "@gmail.com" );
          user.Password = "******" + timestamp;

          Backendless.UserService.Register( user,
                                            new ResponseCallback<BackendlessUser>( this )
                                              {
                                                ResponseHandler =
                                                  response => FailCountDownWith( "Server accepted user without identity" ),
                                                ErrorHandler = fault => CheckErrorCode( 3013, fault )
                                              } );
        } );
    }
Exemplo n.º 38
0
    public void TestRegisterNewUserWithoutIdentity()
    {
      try
      {
        Backendless.InitApp( Defaults.TEST_APP_ID, Defaults.TEST_SECRET_KEY, Defaults.TEST_VERSION );
        String timestamp = DateTime.Now.Ticks.ToString();
        BackendlessUser user = new BackendlessUser();
        user.SetProperty( EMAIL_KEY, "bot" + timestamp + "@gmail.com" );
        user.Password = "******" + timestamp;

        Backendless.UserService.Register( user );

        Assert.Fail( "Server accepted user without identity" );
      }
      catch( System.Exception t )
      {
        CheckErrorCode( 3013, t );
      }
    }