forked from bitbeans/zxcvbn-cs
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tony Richards
committed
Oct 28, 2020
1 parent
8bc21ac
commit d1b008e
Showing
2 changed files
with
43 additions
and
1 deletion.
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,42 @@ | ||
using FluentAssertions; | ||
using Xunit; | ||
using Zxcvbn.Matcher; | ||
using Zxcvbn.Matcher.Matches; | ||
|
||
namespace Zxcvbn.Tests.Scoring | ||
{ | ||
public class RegexScoringTests | ||
{ | ||
[Fact] | ||
public void CalculatesWithReferenceYear() | ||
{ | ||
var match = new RegexMatch | ||
{ | ||
Token = "1972", | ||
RegexName = "recent_year", | ||
i = 1, | ||
j = 2, | ||
Pattern = "regex" | ||
}; | ||
|
||
var result = PasswordScoring.EstimateGuesses(match, "1972"); | ||
result.Should().Be(DateMatcher.ReferenceYear - 1972); | ||
} | ||
|
||
[Fact] | ||
public void IsDelegatedToByEstimateGuesses() | ||
{ | ||
var match = new RegexMatch | ||
{ | ||
Token = "1972", | ||
RegexName = "recent_year", | ||
i = 1, | ||
j = 2, | ||
Pattern = "regex" | ||
}; | ||
|
||
var result = PasswordScoring.EstimateGuesses(match, "1972"); | ||
result.Should().Be(DateMatcher.ReferenceYear - 1972); | ||
} | ||
} | ||
} |
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