Exemplo n.º 1
0
        public void Test_createUser()
        {
            UserModel user = new UserModel();

            user.UserName = "******" + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
            user.firstName ="fn"+ DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
            user.lastName = "ln" + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
            user.Password="******";
            user.Email = "*****@*****.**";

            Assert.AreEqual(true, user.UserRegister());

            bool Recived = user.GetUser(user._id);

            Assert.AreEqual(true, Recived);

            string nameTempUser = string.Empty;

            Random my_random = new Random(DateTime.Now.Millisecond);
            int num_random = my_random.Next(0, 99);

            nameTempUser = "******" + num_random;

            user.firstName = nameTempUser;

            if (user.UserSave()) {

                user.GetUser( user._id);

                Assert.AreEqual(nameTempUser, user.firstName);
            }

            Assert.IsTrue(user.UserDelete( user._id ));
        }
Exemplo n.º 2
0
 public ActionResult Delete()
 {
     UserModel User = new UserModel();
     User = (UserModel)Session["loggedUser"];
     FormsAuthentication.SignOut();
     User.UserDelete( User._id );
     return Redirect("Home/index");
 }