コード例 #1
0
        public void TestMethodSocketLogOn()
        {
            LogInSocketController controller = new LogInSocketController();
            LogIn LogOn = new LogIn();
            LogOn.PassWord = "******";
            LogOn.UserName = "******";

            // Act
            ViewResult result = controller.LogOn(LogOn,"") as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
コード例 #2
0
        public ActionResult LogOn(LogIn model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                string retVal = _LogOnSocket.AuthenticateLogIn(model.UserName, model.PassWord);
                if (retVal == "True")
                {
                    ModelState.AddModelError("", "The user is Authenticated with Sockets.");
                }
                else if (retVal == "False")
                {
                    ModelState.AddModelError("", "The user is not Authenticated.");
                }
                else
                {
                    ModelState.AddModelError("", retVal);
                }

            }

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