Exemplo n.º 1
0
        public void IsDelegatedToByEstimateGuesses()
        {
            var match = new RegexMatch
            {
                Token     = "1972",
                RegexName = "recent_year",
                i         = 1,
                j         = 2,
            };

            var result = PasswordScoring.EstimateGuesses(match, "1972");

            result.Should().Be(DateMatcher.ReferenceYear - 1972);
        }
Exemplo n.º 2
0
        public void IsDelegatedToBeEstimateGuesses()
        {
            var match = new DateMatch
            {
                Token     = "1923",
                Separator = string.Empty,
                Year      = 1923,
                Month     = 1,
                Day       = 1,
                i         = 1,
                j         = 2,
            };

            var actual   = PasswordScoring.EstimateGuesses(match, "1923");
            var expected = 365 * (DateMatcher.ReferenceYear - match.Year);

            actual.Should().Be(expected);
        }
Exemplo n.º 3
0
        public void IsDelegatedToByEstimateGuesses()
        {
            var match = new RepeatMatch
            {
                Token          = "aa",
                BaseToken      = "a",
                BaseGuesses    = PasswordScoring.MostGuessableMatchSequence("a", Core.GetAllMatches("a")).Guesses,
                BaseMatchItems = new List <Match>(),
                RepeatCount    = 2,
                i = 1,
                j = 2,
            };

            var expected = RepeatGuessesCalculator.CalculateGuesses(match);
            var actual   = PasswordScoring.EstimateGuesses(match, "aa");

            actual.Should().Be(expected);
        }
Exemplo n.º 4
0
        public void ReturnsCachedGuessesIfAvailable()
        {
            var match = new DateMatch
            {
                Guesses   = 1,
                Token     = "1977",
                Year      = 1977,
                Month     = 8,
                Day       = 14,
                Separator = "/",
                i         = 1,
                j         = 2,
            };

            var actual = PasswordScoring.EstimateGuesses(match, string.Empty);

            actual.Should().Be(1);
        }
Exemplo n.º 5
0
        public void IsDelegatedToByEstimateGuesses()
        {
            var match = new SpatialMatch
            {
                Token        = "zxcvbn",
                Graph        = "qwerty",
                Turns        = 1,
                ShiftedCount = 0,
                i            = 1,
                j            = 2,
            };

            var expected = SpatialGuessesCalculator.KeyboardStartingPositions * SpatialGuessesCalculator.KeyboardAverageDegree * (match.Token.Length - 1);

            var actual = PasswordScoring.EstimateGuesses(match, match.Token);

            actual.Should().Be(expected);
        }
        public void IsDelegatedToByEstimateGuesses()
        {
            var match = new DictionaryMatch
            {
                Token          = "aaaaa",
                Rank           = 32,
                DictionaryName = "dic",
                i           = 1,
                j           = 2,
                L33t        = false,
                MatchedWord = "a",
                Reversed    = false,
            };

            var expected = 32;
            var actual   = PasswordScoring.EstimateGuesses(match, "aaaaa");

            actual.Should().Be(expected);
        }