@@ -253,5 +253,31 @@ public void WhenGivenAQueryResultsShouldGiveMoreScoreWeightToStartOfNewWord(stri
253
253
$ "Should be greater than{ Environment . NewLine } " +
254
254
$ "CompareString2: \" { compareString2 } \" , Score: { compareString1Result . Score } { Environment . NewLine } ") ;
255
255
}
256
+
257
+ [ TestCase ( "vim" , "Vim" , "ignoreDescription" , "ignore.exe" , "Vim Diff" , "ignoreDescription" , "ignore.exe" ) ]
258
+ public void WhenMultipleResults_ExactMatchingResult_ShouldHaveGreatestScore (
259
+ string queryString , string firstName , string firstDescription , string firstExecutableName ,
260
+ string secondName , string secondDescription , string secondExecutableName )
261
+ {
262
+ // Act
263
+ var matcher = new StringMatcher ( ) ;
264
+ var firstNameMatch = matcher . FuzzyMatch ( queryString , firstName ) . RawScore ;
265
+ var firstDescriptionMatch = matcher . FuzzyMatch ( queryString , firstDescription ) . RawScore ;
266
+ var firstExecutableNameMatch = matcher . FuzzyMatch ( queryString , firstExecutableName ) . RawScore ;
267
+
268
+ var secondNameMatch = matcher . FuzzyMatch ( queryString , secondName ) . RawScore ;
269
+ var secondDescriptionMatch = matcher . FuzzyMatch ( queryString , secondDescription ) . RawScore ;
270
+ var secondExecutableNameMatch = matcher . FuzzyMatch ( queryString , secondExecutableName ) . RawScore ;
271
+
272
+ var firstScore = new [ ] { firstNameMatch , firstDescriptionMatch , firstExecutableNameMatch } . Max ( ) ;
273
+ var secondScore = new [ ] { secondNameMatch , secondDescriptionMatch , secondExecutableNameMatch } . Max ( ) ;
274
+
275
+ // Assert
276
+ Assert . IsTrue ( firstScore > secondScore ,
277
+ $ "Query: \" { queryString } \" { Environment . NewLine } " +
278
+ $ "Name of first: \" { firstName } \" , Final Score: { firstScore } { Environment . NewLine } " +
279
+ $ "Should be greater than{ Environment . NewLine } " +
280
+ $ "Name of second: \" { secondName } \" , Final Score: { secondScore } { Environment . NewLine } ") ;
281
+ }
256
282
}
257
283
}
0 commit comments