Beispiel #1
0
        public void IsExpired_ShouldReturnFalse_WhenExpiresIsTrueAndExpiryTimeInTheFuture()
        {
            var pwEntry = new PwEntry(true, true)
            {
                Expires    = true,
                ExpiryTime = DateTime.UtcNow.AddSeconds(2)
            };

            Assert.IsFalse(pwEntry.IsExpired());
        }
Beispiel #2
0
        public void IsExpired_ShouldReturnFalse_WhenExpiresIsFalseAndExpiryTimeInThePast()
        {
            var pwEntry = new PwEntry(true, true)
            {
                Expires    = false,
                ExpiryTime = DateTime.MinValue
            };

            Assert.IsFalse(pwEntry.IsExpired());
        }
        /// <summary>
        /// Checks whether the entry should be ignored or not
        /// Any other <c>PwEntryIgnoreState</c> than <c>PwEntryIgnoreState.None</c> will be ignored
        /// </summary>
        /// <param name="pwEntry">The password entry</param>
        /// <returns>The <c>PwEntryIgnoreState</c> with the ignore reason</returns>
        private PwEntryIgnoreState CheckEntryIgnoreConditions(PwEntry pwEntry)
        {
            if (_isIgnoreExpiredEntriesEnabled && pwEntry.IsExpired())
            {
                return(PwEntryIgnoreState.IsExpired);
            }

            if (pwEntry.HasTag(IgnorePwnedTag))
            {
                return(PwEntryIgnoreState.IsIgnored);
            }

            return(PwEntryIgnoreState.None);
        }