@@ -77,7 +77,7 @@ public void MatchTest()
77
77
}
78
78
79
79
[ TestCase ( "Chrome" ) ]
80
- public void WhenGivenNotAllCharactersFoundInSearchStringThenShouldReturnZeroScore ( string searchString )
80
+ public void WhenNotAllCharactersFoundInSearchString_ThenShouldReturnZeroScore ( string searchString )
81
81
{
82
82
var compareString = "Can have rum only in my glass" ;
83
83
var matcher = new StringMatcher ( ) ;
@@ -92,7 +92,7 @@ public void WhenGivenNotAllCharactersFoundInSearchStringThenShouldReturnZeroScor
92
92
[ TestCase ( "cand" ) ]
93
93
[ TestCase ( "cpywa" ) ]
94
94
[ TestCase ( "ccs" ) ]
95
- public void WhenGivenStringsAndAppliedPrecisionFilteringThenShouldReturnGreaterThanPrecisionScoreResults ( string searchTerm )
95
+ public void GivenQueryString_WhenAppliedPrecisionFiltering_ThenShouldReturnGreaterThanPrecisionScoreResults ( string searchTerm )
96
96
{
97
97
var results = new List < Result > ( ) ;
98
98
var matcher = new StringMatcher ( ) ;
@@ -107,7 +107,10 @@ public void WhenGivenStringsAndAppliedPrecisionFilteringThenShouldReturnGreaterT
107
107
108
108
foreach ( var precisionScore in GetPrecisionScores ( ) )
109
109
{
110
- var filteredResult = results . Where ( result => result . Score >= precisionScore ) . Select ( result => result ) . OrderByDescending ( x => x . Score ) . ToList ( ) ;
110
+ var filteredResult = results . Where ( result => result . Score >= precisionScore )
111
+ . Select ( result => result )
112
+ . OrderByDescending ( x => x . Score )
113
+ . ToList ( ) ;
111
114
112
115
Debug . WriteLine ( "" ) ;
113
116
Debug . WriteLine ( "###############################################" ) ;
@@ -130,14 +133,16 @@ public void WhenGivenStringsAndAppliedPrecisionFilteringThenShouldReturnGreaterT
130
133
[ TestCase ( Chrome , CandyCrushSagaFromKing , 0 ) ]
131
134
[ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , 110 ) ]
132
135
[ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , 121 ) ] //double spacing intended
133
- public void WhenGivenQueryStringThenShouldReturnCurrentScoring ( string queryString , string compareString , int expectedScore )
136
+ public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring (
137
+ string queryString , string compareString , int expectedScore )
134
138
{
135
139
// When, Given
136
140
var matcher = new StringMatcher ( ) ;
137
141
var rawScore = matcher . FuzzyMatch ( queryString , compareString ) . RawScore ;
138
142
139
143
// Should
140
- Assert . AreEqual ( expectedScore , rawScore , $ "Expected score for compare string '{ compareString } ': { expectedScore } , Actual: { rawScore } ") ;
144
+ Assert . AreEqual ( expectedScore , rawScore ,
145
+ $ "Expected score for compare string '{ compareString } ': { expectedScore } , Actual: { rawScore } ") ;
141
146
}
142
147
143
148
[ TestCase ( "goo" , "Google Chrome" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
@@ -150,7 +155,7 @@ public void WhenGivenQueryStringThenShouldReturnCurrentScoring(string queryStrin
150
155
[ TestCase ( "ccs" , "Candy Crush Saga from King" , StringMatcher . SearchPrecisionScore . Low , true ) ]
151
156
[ TestCase ( "cand" , "Candy Crush Saga from King" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
152
157
[ TestCase ( "cand" , "Help cure hope raise on mind entity Chrome" , StringMatcher . SearchPrecisionScore . Regular , false ) ]
153
- public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual (
158
+ public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual (
154
159
string queryString ,
155
160
string compareString ,
156
161
StringMatcher . SearchPrecisionScore expectedPrecisionScore ,
@@ -199,7 +204,7 @@ public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual(
199
204
[ TestCase ( "cod" , VisualStudioCode , StringMatcher . SearchPrecisionScore . Regular , true ) ]
200
205
[ TestCase ( "code" , VisualStudioCode , StringMatcher . SearchPrecisionScore . Regular , true ) ]
201
206
[ TestCase ( "codes" , "Visual Studio Codes" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
202
- public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings (
207
+ public void WhenGivenQuery_ShouldReturnResults_ContainingAllQuerySubstrings (
203
208
string queryString ,
204
209
string compareString ,
205
210
StringMatcher . SearchPrecisionScore expectedPrecisionScore ,
@@ -229,7 +234,8 @@ public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings(
229
234
[ TestCase ( "man" , "Task Manager" , "eManual" ) ]
230
235
[ TestCase ( "term" , "Windows Terminal" , "Character Map" ) ]
231
236
[ TestCase ( "winterm" , "Windows Terminal" , "Cygwin64 Terminal" ) ]
232
- public void WhenGivenAQueryResultsShouldGiveMoreScoreWeightToStartOfNewWord ( string queryString , string compareString1 , string compareString2 )
237
+ public void WhenGivenAQuery_Scoring_ShouldGiveMoreWeightToStartOfNewWord (
238
+ string queryString , string compareString1 , string compareString2 )
233
239
{
234
240
// When
235
241
var matcher = new StringMatcher { UserSettingSearchPrecision = StringMatcher . SearchPrecisionScore . Regular } ;
0 commit comments