Ejemplo n.º 1
0
        public void AControllerTest()
        {
            JCE_STD.Models.LogOnModel model = new Models.LogOnModel();
            JCE_STD.Controllers.AccountController AC = new Controllers.AccountController();
            JCE_STD.Controllers.HomeController success = new Controllers.HomeController();
            RouteValueDictionary rDic = new RouteValueDictionary();
            RedirectToRouteResult r = new RedirectToRouteResult("success",rDic);
            model.UserName = "******";
            model.Password = "******";
               /*  Assert.AreEqual(r, AC.LogOn(model)); */

             ViewResult abc = new ViewResult();

            Assert.AreEqual(abc.View, AC.LogOn(model));
        }
Ejemplo n.º 2
0
        public ActionResult LogOn(LogOnModel model)
        {
            if (ModelState.IsValid)//manual implementation of the login for the project staff only
            {
                if (model.UserName == "motiaz" && model.Password == "1234")
                {
                    return RedirectToAction("moti","Home");
                }
                else if (model.UserName == "stasbe" && model.Password == "1234")
                {
                    return RedirectToAction("stas", "Home");
                }
                else if (model.UserName == "orenzv" && model.Password == "1234")
                {
                    return RedirectToAction("oren", "Home");
                }
                else if (model.UserName == "arielle" && model.Password == "1234")
                {
                    return RedirectToAction("ariel", "Home");
                }
                else
                {   //wrong pass
                    ModelState.AddModelError("", "שם המשתמש או הסיסמא שגויים,נסה שנית.");
                }
            }
            else
                {
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                }

            // If we got this far, something failed, redisplay form
            return View(model);
        }