public void Authenticate_should_respond_null_if_incorrect_login_and_notnull_if_correct_login()
        {
            var password = Fixture.Create <string>();

            // Act
            var response  = Repository.Authenticate(_userData.Username, password).GetAwaiter().GetResult();
            var response2 = Repository.Authenticate(Fixture.Create <string>(), _userData.Username).GetAwaiter().GetResult();
            var response3 = Repository.Authenticate(_userData.Username, _mockPassword).GetAwaiter().GetResult();

            // Assert
            Assert.IsNull(response);
            Assert.IsNull(response2);
            Assert.IsNotNull(response3);
        }
        public void Authenticate()
        {
            var usersRepository = new UsersRepository(new MainUnitOfWork(ConfigurationManager.AppSettings["AzureConnectionString"]));

            var request = new AuthenticationRequest();
            var result = usersRepository.Authenticate(9822559890, "test123");
            Assert.IsNotNull(result);
        }
        // [ValidateAccountStatus]
        public ActionResult Authenticate(UserAuthenticationModel model)
        {
            if (_usersRepo.Authenticate(model))
            {
                return(RedirectToAction("Index", "Home"));
            }

            ViewBag.Message = "Email si / sau parola incorecte.";
            return(View());
        }
Example #4
0
 public User GetUser(string login, string password)
 {
     if (UsersRepo.Authenticate(login, password) == true)
     {
         return(UsersRepo.GetUser(login));
     }
     else
     {
         return(null);
     }
 }