Ejemplo n.º 1
0
        private void SetUpData()
        {
            account = ObjectFactory.CreateAccount();

            context.Set<Account>().Add(account);
            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void CanLogin_LockedAccount_ReturnsFalse()
        {
            AccountLoginView view = ObjectFactory.CreateAccountLoginView();
            account = context.Set<Account>().Single();
            account.IsLocked = true;
            context.SaveChanges();

            Boolean canLogin = validator.CanLogin(view);
            Alert alert = validator.Alerts.Single();

            Assert.False(canLogin);
            Assert.Empty(validator.ModelState);
            Assert.Equal(0, alert.FadeoutAfter);
            Assert.Equal(AlertType.Danger, alert.Type);
            Assert.Equal(Validations.AccountIsLocked, alert.Message);
        }
Ejemplo n.º 3
0
        private void SetUpData()
        {
            account = ObjectFactory.CreateAccount();
            account.Role = ObjectFactory.CreateRole();
            account.RoleId = account.Role.Id;
            account.IsLocked = false;

            context.Set<Account>().Add(account);
            context.SaveChanges();
        }
Ejemplo n.º 4
0
        public void CanLogin_IncorrectPassword_ReturnsFalse()
        {
            account = context.Set<Account>().Single();
            account.IsLocked = true;
            context.SaveChanges();

            AccountLoginView view = ObjectFactory.CreateAccountLoginView();
            hasher.VerifyPassword(view.Password, Arg.Any<String>()).Returns(false);

            Boolean canLogin = validator.CanLogin(view);

            Assert.False(canLogin);
            Assert.Empty(validator.Alerts);
            Assert.Single(validator.ModelState);
            Assert.Equal(Validations.IncorrectAuthentication, validator.ModelState[""].Errors.Single().ErrorMessage);
        }