Exemple #1
0
        public void CheckLog_in()
        {
            Account_Logic accountLogic = new Account_Logic();

            // Arrange
            Account account = new Account("Bert", "123456", "*****@*****.**");

            Assert.False(accountLogic.Log_in(account.Name, account.Password));

            // Act
            Assert.True(accountLogic.Register(account));

            // Assert
            Assert.True(accountLogic.Log_in(account.Name, account.Password));
        }
Exemple #2
0
        public void CheckLog_in()
        {
            // Arrange
            Account account = new Account(1, "Bert", "123456", "*****@*****.**");

            Assert.False(accountLogic.Log_in(account.Name, account.Password));

            // Act
            Assert.True(accountLogic.CheckRegisterData(account));
            Assert.True(accountLogic.CheckRegisterName(account));
            Assert.True(accountLogic.CheckRegisterPassword(account));

            // Assert
            Assert.True(accountLogic.Log_in(account.Name, account.Password));
        }
 public IActionResult Log_in(Account account)
 {
     if (logic.Log_in(account.Name, account.Password))
     {
         HttpContext.Session.SetString(SessionKeyName, account.Name);
         HttpContext.Session.SetInt32(SessionKeyId, account.Account_Id);
         return(RedirectToAction("Index", "Home"));
     }
     else
     {
         return(RedirectToAction("Log_inpage"));
     }
 }