Example #1
0
        public void Search()
        {
            // Arrange
            UsrNf userinfo = new UsrNf();

            userinfo.Usrd = "tester";
            userinfo.Grpd = "TEST1";

            var contextMock     = new Mock <ControllerContext>();
            var mockHttpContext = new Mock <HttpContextBase>();
            var session         = new Mock <HttpSessionStateBase>();

            mockHttpContext.Setup(ctx => ctx.Session).Returns(session.Object);
            contextMock.Setup(ctx => ctx.HttpContext).Returns(mockHttpContext.Object);

            contextMock.SetupGet(p => p.HttpContext.Session[Define.USER_SESSION_NAME]).Returns(userinfo);

            AjaxController controller = new AjaxController();

            controller.ControllerContext = contextMock.Object;

            SearchBean bean = new SearchBean();

            bean.Year  = "2017";
            bean.Month = "01";
            JsonResult result = controller.Search(bean) as JsonResult;

            Console.WriteLine("OK");

            // Assert
            //Assert.AreEqual("Modify this template to jump-start your ASP.NET MVC application.", result.ViewBag.Message);
        }
Example #2
0
        public void SelectForSign()
        {
            UsrNfDao dao = FactoryDao.Instance().GetUsrNfDao();
            UsrNf    ret = dao.SelectForSign("SY01", "nowonbun", "ghkdtsnduq1");

            Assert.AreEqual(ret.Nm, "SoonYub Hwang");
            ret = dao.SelectForSign("SY01", "nowonbun", "ghkdtsnd");
            Assert.AreEqual(ret.Nm, null);
        }
Example #3
0
        private void Login(LoginBean bean, bool md5Crypt)
        {
            UsrNf user = usrNfDao.SelectForSign(bean.InputGroup, bean.InuptId, md5Crypt ? Util.MD5HashCrypt(bean.InputPassword) : bean.InputPassword);

            if (user == null)
            {
                bean.ErrorMessage = Message.LOGIN_ERROR;
            }
            else
            {
                UserSession = user;
                FormsAuthentication.SetAuthCookie(user.Nm, false);
                if (!String.IsNullOrEmpty(bean.Remember))
                {
                    SetInfoToCookie();
                }
            }
        }