public void IsActive_ReturnsAccountState(Boolean isLocked)
        {
            account.IsLocked = isLocked;
            context.Update(account);
            context.SaveChanges();

            Boolean actual   = service.IsActive(account.Id);
            Boolean expected = !isLocked;

            Assert.Equal(expected, actual);
        }
Example #2
0
        public void CanReset_ExpiredToken_ReturnsFalse()
        {
            account.RecoveryTokenExpirationDate = DateTime.Now.AddMinutes(-5);
            context.Update(account);
            context.SaveChanges();

            Boolean canReset = validator.CanReset(ObjectsFactory.CreateAccountResetView());
            Alert   alert    = validator.Alerts.Single();

            Assert.False(canReset);
            Assert.Equal(0, alert.Timeout);
            Assert.Empty(validator.ModelState);
            Assert.Equal(AlertType.Danger, alert.Type);
            Assert.Equal(Validation.For <AccountView>("ExpiredToken"), alert.Message);
        }