Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide expired entries in the popup menu (#82)
* Add an expired entry to Test.kdbx * Moved the filtering logic to a separate method * Added a few unit tests
- Loading branch information
1 parent
f700c6e
commit f6d1206
Showing
5 changed files
with
98 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using KeePassLib; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using System; | ||
|
||
namespace KeeTrayTOTP.Tests | ||
{ | ||
[TestClass] | ||
public class ExpiryTests | ||
{ | ||
[TestMethod] | ||
public void IsExpired_ShouldReturnTrue_WhenExpiresIsTrueAndExpiryTimeInThePast() | ||
{ | ||
var pwEntry = new PwEntry(true, true) | ||
{ | ||
Expires = true, | ||
ExpiryTime = DateTime.MinValue | ||
}; | ||
|
||
Assert.IsTrue(pwEntry.IsExpired()); | ||
} | ||
|
||
[TestMethod] | ||
public void IsExpired_ShouldReturnFalse_WhenExpiresIsTrueAndExpiryTimeInTheFuture() | ||
{ | ||
var pwEntry = new PwEntry(true, true) | ||
{ | ||
Expires = true, | ||
ExpiryTime = DateTime.UtcNow.AddSeconds(2) | ||
}; | ||
|
||
Assert.IsFalse(pwEntry.IsExpired()); | ||
} | ||
|
||
[TestMethod] | ||
public void IsExpired_ShouldReturnFalse_WhenExpiresIsFalseAndExpiryTimeInThePast() | ||
{ | ||
var pwEntry = new PwEntry(true, true) | ||
{ | ||
Expires = false, | ||
ExpiryTime = DateTime.MinValue | ||
}; | ||
|
||
Assert.IsFalse(pwEntry.IsExpired()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters