Example #1
0
 public MatchResult(bool success, SearchPrecisionScore searchPrecision, List <int> matchData, int rawScore)
 {
     Success         = success;
     SearchPrecision = searchPrecision;
     MatchData       = matchData;
     RawScore        = rawScore;
 }
Example #2
0
        public void WhenGivenQuery_ShouldReturnResults_ContainingAllQuerySubstrings(
            string queryString,
            string compareString,
            SearchPrecisionScore expectedPrecisionScore,
            bool expectedPrecisionResult)
        {
            // When
            var matcher = new StringMatcher {
                UserSettingSearchPrecision = expectedPrecisionScore
            };

            // Given
            var matchResult = matcher.FuzzyMatch(queryString, compareString);

            Debug.WriteLine("");
            Debug.WriteLine("###############################################");
            Debug.WriteLine($"QueryString: {queryString}     CompareString: {compareString}");
            Debug.WriteLine(
                $"RAW SCORE: {matchResult.RawScore.ToString()}, PrecisionLevelSetAt: {expectedPrecisionScore} ({(int) expectedPrecisionScore})");
            Debug.WriteLine("###############################################");
            Debug.WriteLine("");

            // Should
            Assert.AreEqual(expectedPrecisionResult, matchResult.IsSearchPrecisionScoreMet(),
                            $"Query:{queryString}{Environment.NewLine} " +
                            $"Compare:{compareString}{Environment.NewLine}" +
                            $"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
                            $"Precision Score: {(int)expectedPrecisionScore}");
        }
Example #3
0
 public MatchResult(bool success, SearchPrecisionScore searchPrecision)
 {
     Success         = success;
     SearchPrecision = searchPrecision;
 }