示例#1
0
        public void ShouldCreateUser()
        {
            MyUsergridUser user = new MyUsergridUser { UserName = "******", Password = "******", Email = "*****@*****.**", City = "city1" };
            _client.CreateUser(user);
            user = _client.GetUser<MyUsergridUser>("user1");

            Assert.IsNotNull(user);
            Assert.AreEqual("user1", user.UserName);
            Assert.AreEqual("*****@*****.**", user.Email);
            Assert.AreEqual("city1", user.City);
            Assert.IsNull(user.Password);

            _client.DeleteUser("user1");
        }
示例#2
0
        public void ShouldChangePassword()
        {
            MyUsergridUser user = new MyUsergridUser { UserName = "******", Password = "******", Email = "*****@*****.**", City = "city1" };
            _client.CreateUser(user);

            user = _client.GetUser<MyUsergridUser>("user1");
            Assert.IsNotNull(user);

            _client.Login("user1", "user1", AuthType.User);

            _client.ChangePassword("user1", "user1", "user1-2");

            _client.Login("user1", "user1-2", AuthType.User);
        }
示例#3
0
        private static void CreateUser(string username, IClient client)
        {
            var userEntity = new MyUsergridUser {
                UserName = username
            };
            // See if this user exists
            var userFromUsergrid = client.GetUser <UsergridUser>(username);

            // Delete if exists
            if (userFromUsergrid != null)
            {
                client.DeleteUser(username);
            }
            // Now create the user
            client.CreateUser(userEntity);
        }
示例#4
0
        public void ShouldCreateUser()
        {
            MyUsergridUser user = new MyUsergridUser {
                UserName = "******", Password = "******", Email = "*****@*****.**", City = "city1"
            };

            _client.CreateUser(user);
            user = _client.GetUser <MyUsergridUser>("user1");

            Assert.IsNotNull(user);
            Assert.AreEqual("user1", user.UserName);
            Assert.AreEqual("*****@*****.**", user.Email);
            Assert.AreEqual("city1", user.City);
            Assert.IsNull(user.Password);

            _client.DeleteUser("user1");
        }
示例#5
0
        public void ShouldChangePassword()
        {
            MyUsergridUser user = new MyUsergridUser {
                UserName = "******", Password = "******", Email = "*****@*****.**", City = "city1"
            };

            _client.CreateUser(user);

            user = _client.GetUser <MyUsergridUser>("user1");
            Assert.IsNotNull(user);

            _client.Login("user1", "user1", AuthType.User);

            _client.ChangePassword("user1", "user1", "user1-2");

            _client.Login("user1", "user1-2", AuthType.User);
        }
示例#6
0
 private static void CreateUser(string username, IClient client)
 {
     var userEntity = new MyUsergridUser {UserName = username};
     // See if this user exists
     var userFromUsergrid = client.GetUser<UsergridUser>(username);
     // Delete if exists
     if (userFromUsergrid != null) {
         client.DeleteUser(username);
     }
     // Now create the user
     client.CreateUser(userEntity);
 }