33using System . Diagnostics ;
44using System . Linq ;
55using NUnit . Framework ;
6+ using NUnit . Framework . Legacy ;
67using Flow . Launcher . Infrastructure ;
78using Flow . Launcher . Plugin ;
89using Flow . Launcher . Plugin . SharedModels ;
@@ -21,8 +22,8 @@ public class FuzzyMatcherTest
2122 private const string MicrosoftSqlServerManagementStudio = "Microsoft SQL Server Management Studio" ;
2223 private const string VisualStudioCode = "Visual Studio Code" ;
2324
24- public List < string > GetSearchStrings ( )
25- => new List < string >
25+ public static List < string > GetSearchStrings ( )
26+ => new ( )
2627 {
2728 Chrome ,
2829 "Choose which programs you want Windows to use for activities like web browsing, editing photos, sending e-mail, and playing music." ,
@@ -34,7 +35,7 @@ public List<string> GetSearchStrings()
3435 OneOneOneOne
3536 } ;
3637
37- public List < int > GetPrecisionScores ( )
38+ public static List < int > GetPrecisionScores ( )
3839 {
3940 var listToReturn = new List < int > ( ) ;
4041
@@ -71,10 +72,10 @@ public void MatchTest()
7172
7273 results = results . Where ( x => x . Score > 0 ) . OrderByDescending ( x => x . Score ) . ToList ( ) ;
7374
74- Assert . IsTrue ( results . Count == 3 ) ;
75- Assert . IsTrue ( results [ 0 ] . Title == "Inste" ) ;
76- Assert . IsTrue ( results [ 1 ] . Title == "Install Package" ) ;
77- Assert . IsTrue ( results [ 2 ] . Title == "file open in browser-test" ) ;
75+ ClassicAssert . IsTrue ( results . Count == 3 ) ;
76+ ClassicAssert . IsTrue ( results [ 0 ] . Title == "Inste" ) ;
77+ ClassicAssert . IsTrue ( results [ 1 ] . Title == "Install Package" ) ;
78+ ClassicAssert . IsTrue ( results [ 2 ] . Title == "file open in browser-test" ) ;
7879 }
7980
8081 [ TestCase ( "Chrome" ) ]
@@ -84,7 +85,7 @@ public void WhenNotAllCharactersFoundInSearchString_ThenShouldReturnZeroScore(st
8485 var matcher = new StringMatcher ( ) ;
8586 var scoreResult = matcher . FuzzyMatch ( searchString , compareString ) . RawScore ;
8687
87- Assert . True ( scoreResult == 0 ) ;
88+ ClassicAssert . True ( scoreResult == 0 ) ;
8889 }
8990
9091 [ TestCase ( "chr" ) ]
@@ -125,7 +126,7 @@ public void GivenQueryString_WhenAppliedPrecisionFiltering_ThenShouldReturnGreat
125126 Debug . WriteLine ( "###############################################" ) ;
126127 Debug . WriteLine ( "" ) ;
127128
128- Assert . IsFalse ( filteredResult . Any ( x => x . Score < precisionScore ) ) ;
129+ ClassicAssert . IsFalse ( filteredResult . Any ( x => x . Score < precisionScore ) ) ;
129130 }
130131 }
131132
@@ -151,7 +152,7 @@ public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring(
151152 var rawScore = matcher . FuzzyMatch ( queryString , compareString ) . RawScore ;
152153
153154 // Should
154- Assert . AreEqual ( expectedScore , rawScore ,
155+ ClassicAssert . AreEqual ( expectedScore , rawScore ,
155156 $ "Expected score for compare string '{ compareString } ': { expectedScore } , Actual: { rawScore } ") ;
156157 }
157158
@@ -190,12 +191,12 @@ public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual(
190191 Debug . WriteLine ( "###############################################" ) ;
191192 Debug . WriteLine ( $ "QueryString: { queryString } CompareString: { compareString } ") ;
192193 Debug . WriteLine (
193- $ "RAW SCORE: { matchResult . RawScore . ToString ( ) } , PrecisionLevelSetAt: { expectedPrecisionScore } ({ ( int ) expectedPrecisionScore } )") ;
194+ $ "RAW SCORE: { matchResult . RawScore } , PrecisionLevelSetAt: { expectedPrecisionScore } ({ ( int ) expectedPrecisionScore } )") ;
194195 Debug . WriteLine ( "###############################################" ) ;
195196 Debug . WriteLine ( "" ) ;
196197
197198 // Should
198- Assert . AreEqual ( expectedPrecisionResult , matchResult . IsSearchPrecisionScoreMet ( ) ,
199+ ClassicAssert . AreEqual ( expectedPrecisionResult , matchResult . IsSearchPrecisionScoreMet ( ) ,
199200 $ "Query: { queryString } { Environment . NewLine } " +
200201 $ "Compare: { compareString } { Environment . NewLine } " +
201202 $ "Raw Score: { matchResult . RawScore } { Environment . NewLine } " +
@@ -241,12 +242,12 @@ public void WhenGivenQuery_ShouldReturnResults_ContainingAllQuerySubstrings(
241242 Debug . WriteLine ( "###############################################" ) ;
242243 Debug . WriteLine ( $ "QueryString: { queryString } CompareString: { compareString } ") ;
243244 Debug . WriteLine (
244- $ "RAW SCORE: { matchResult . RawScore . ToString ( ) } , PrecisionLevelSetAt: { expectedPrecisionScore } ({ ( int ) expectedPrecisionScore } )") ;
245+ $ "RAW SCORE: { matchResult . RawScore } , PrecisionLevelSetAt: { expectedPrecisionScore } ({ ( int ) expectedPrecisionScore } )") ;
245246 Debug . WriteLine ( "###############################################" ) ;
246247 Debug . WriteLine ( "" ) ;
247248
248249 // Should
249- Assert . AreEqual ( expectedPrecisionResult , matchResult . IsSearchPrecisionScoreMet ( ) ,
250+ ClassicAssert . AreEqual ( expectedPrecisionResult , matchResult . IsSearchPrecisionScoreMet ( ) ,
250251 $ "Query:{ queryString } { Environment . NewLine } " +
251252 $ "Compare:{ compareString } { Environment . NewLine } " +
252253 $ "Raw Score: { matchResult . RawScore } { Environment . NewLine } " +
@@ -277,7 +278,7 @@ public void WhenGivenAQuery_Scoring_ShouldGiveMoreWeightToStartOfNewWord(
277278 Debug . WriteLine ( "" ) ;
278279
279280 // Should
280- Assert . True ( compareString1Result . Score > compareString2Result . Score ,
281+ ClassicAssert . True ( compareString1Result . Score > compareString2Result . Score ,
281282 $ "Query: \" { queryString } \" { Environment . NewLine } " +
282283 $ "CompareString1: \" { compareString1 } \" , Score: { compareString1Result . Score } { Environment . NewLine } " +
283284 $ "Should be greater than{ Environment . NewLine } " +
@@ -310,7 +311,7 @@ public void WhenGivenTwoStrings_Scoring_ShouldGiveMoreWeightToTheStringCloserToI
310311 Debug . WriteLine ( "" ) ;
311312
312313 // Should
313- Assert . True ( compareString1Result . Score > compareString2Result . Score ,
314+ ClassicAssert . True ( compareString1Result . Score > compareString2Result . Score ,
314315 $ "Query: \" { queryString } \" { Environment . NewLine } " +
315316 $ "CompareString1: \" { compareString1 } \" , Score: { compareString1Result . Score } { Environment . NewLine } " +
316317 $ "Should be greater than{ Environment . NewLine } " +
@@ -336,7 +337,7 @@ public void WhenMultipleResults_ExactMatchingResult_ShouldHaveGreatestScore(
336337 var secondScore = new [ ] { secondNameMatch , secondDescriptionMatch , secondExecutableNameMatch } . Max ( ) ;
337338
338339 // Assert
339- Assert . IsTrue ( firstScore > secondScore ,
340+ ClassicAssert . IsTrue ( firstScore > secondScore ,
340341 $ "Query: \" { queryString } \" { Environment . NewLine } " +
341342 $ "Name of first: \" { firstName } \" , Final Score: { firstScore } { Environment . NewLine } " +
342343 $ "Should be greater than{ Environment . NewLine } " +
@@ -360,7 +361,7 @@ public void WhenGivenAnAcronymQuery_ShouldReturnAcronymScore(string queryString,
360361 {
361362 var matcher = new StringMatcher ( ) ;
362363 var score = matcher . FuzzyMatch ( queryString , compareString ) . Score ;
363- Assert . IsTrue ( score == desiredScore ,
364+ ClassicAssert . IsTrue ( score == desiredScore ,
364365 $@ "Query: ""{ queryString } ""
365366 CompareString: ""{ compareString } ""
366367 Score: { score }
0 commit comments