public void ShouldNoAuthenticateWhenEmailIsWrong()
        {
            var exp  = UserSpecs.AuthenticateUser("*****@*****.**", "12345");
            var user = _users.AsQueryable().Where(exp).FirstOrDefault();

            Assert.AreEqual(null, user);
        }
        public void AuthenticateUserSpecShouldReturnZero()
        {
            var query = UserSpecs.AuthenticateUser("marcosbaiao222", "marcosbaiao");
            var count = _users.Where(query).Count();

            Assert.AreEqual(0, count);
        }
Beispiel #3
0
        public void ShouldNotAuthenticateWhenPasswordIsWrong()
        {
            var exp  = UserSpecs.AuthenticateUser("*****@*****.**", "1233456");
            var user = _users.AsQueryable().Where(exp).FirstOrDefault();

            Assert.AreEqual(null, user);
        }
Beispiel #4
0
 public User Authenticate(string username, string password)
 {
     return(_context.User
            .Include("ProfileUser")
            .Where(UserSpecs.AuthenticateUser(username, password))
            .FirstOrDefault());
 }
Beispiel #5
0
        public void ShouldNotAuthenticateWhenEmailIsWrong()
        {
            var exp  = UserSpecs.AuthenticateUser("*****@*****.**", "123456");
            var user = _users.AsQueryable().Where(exp).FirstOrDefault();

            Assert.AreEqual(null, user);
        }
Beispiel #6
0
        public void ShouldNotAuthenticateWhenPasswordIsWrong()
        {
            var expression = UserSpecs.AuthenticateUser("*****@*****.**", "13456");
            var user       = _users.AsQueryable().Where(expression).FirstOrDefault();

            Assert.AreEqual(null, user);
        }
        public void AuthenticateUserSpecShouldReturnZero()
        {
            var query = UserSpecs.AuthenticateUser("andrebaltieri222", "andrebaltieri");
            var count = _users.Where(query).Count();

            Assert.AreEqual(0, count);
        }
Beispiel #8
0
        public void ShouldAuthenticate()
        {
            //dado um usuário
            //se obtém a expressão e retorna valor
            var expression = UserSpecs.AuthenticateUser("*****@*****.**", "123456");
            var user       = _users.AsQueryable().Where(expression).FirstOrDefault();

            Assert.AreNotEqual(null, user);
        }
 public User Authenticate(string email, string password)
 {
     return(_context.Users
            .Where(UserSpecs.AuthenticateUser(email, password))
            .FirstOrDefault());
 }
Beispiel #10
0
 public User Authenticate(string username, string password)
 {
     return(_db.Users
            .Where(UserSpecs.AuthenticateUser(username, password))
            .Where(UserSpecs.IsActive()).FirstOrDefault());
 }