@@ -269,5 +269,129 @@ public void GivenDirectoryInfoSearch_WhenSearchPatternHotKeyIsSearchAll_ThenSear
269269            // Then 
270270            Assert . AreEqual ( expectedString ,  resultString ) ; 
271271        } 
272+ 
273+         [ TestCase ( "c:\\ somefolder\\ someotherfolder" ,  ResultType . Folder ,  "irrelevant" ,  false ,  true ,  "c:\\ somefolder\\ someotherfolder\\ " ) ] 
274+         [ TestCase ( "c:\\ somefolder\\ someotherfolder\\ " ,  ResultType . Folder ,  "irrelevant" ,  true ,  true ,  "c:\\ somefolder\\ someotherfolder\\ " ) ] 
275+         [ TestCase ( "c:\\ somefolder\\ someotherfolder" ,  ResultType . Folder ,  "irrelevant" ,  true ,  false ,  "p c:\\ somefolder\\ someotherfolder\\ " ) ] 
276+         [ TestCase ( "c:\\ somefolder\\ someotherfolder\\ " ,  ResultType . Folder ,  "irrelevant" ,  false ,  false ,  "c:\\ somefolder\\ someotherfolder\\ " ) ] 
277+         [ TestCase ( "c:\\ somefolder\\ someotherfolder" ,  ResultType . Folder ,  "p" ,  true ,  false ,  "p c:\\ somefolder\\ someotherfolder\\ " ) ] 
278+         [ TestCase ( "c:\\ somefolder\\ someotherfolder" ,  ResultType . Folder ,  "" ,  true ,  true ,  "c:\\ somefolder\\ someotherfolder\\ " ) ] 
279+         public  void  GivenFolderResult_WhenGetPath_ThenPathShouldBeExpectedString ( 
280+             string  path ,  
281+             ResultType  type ,  
282+             string  actionKeyword , 
283+             bool  pathSearchKeywordEnabled ,  
284+             bool  searchActionKeywordEnabled , 
285+             string  expectedResult ) 
286+         { 
287+             // Given 
288+             var  settings  =  new  Settings ( )  
289+             { 
290+                 PathSearchKeywordEnabled  =  pathSearchKeywordEnabled , 
291+                 PathSearchActionKeyword  =  "p" , 
292+                 SearchActionKeywordEnabled  =  searchActionKeywordEnabled , 
293+                 SearchActionKeyword  =  Query . GlobalPluginWildcardSign 
294+             } ; 
295+             ResultManager . Init ( new  PluginInitContext ( ) ,  settings ) ; 
296+             
297+             // When 
298+             var  result  =  ResultManager . GetPathWithActionKeyword ( path ,  type ,  actionKeyword ) ; 
299+ 
300+             // Then 
301+             Assert . AreEqual ( result ,  expectedResult ) ; 
302+         } 
303+ 
304+         [ TestCase ( "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "irrelevant" ,  false ,  true ,  "e c:\\ somefolder\\ somefile" ) ] 
305+         [ TestCase ( "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "p" ,  true ,  false ,  "p c:\\ somefolder\\ somefile" ) ] 
306+         [ TestCase ( "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "e" ,  true ,  true ,  "e c:\\ somefolder\\ somefile" ) ] 
307+         [ TestCase ( "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "irrelevant" ,  false ,  false ,  "e c:\\ somefolder\\ somefile" ) ] 
308+         public  void  GivenFileResult_WhenGetPath_ThenPathShouldBeExpectedString ( 
309+             string  path , 
310+             ResultType  type , 
311+             string  actionKeyword , 
312+             bool  pathSearchKeywordEnabled , 
313+             bool  searchActionKeywordEnabled , 
314+             string  expectedResult ) 
315+         { 
316+             // Given 
317+             var  settings  =  new  Settings ( ) 
318+             { 
319+                 PathSearchKeywordEnabled  =  pathSearchKeywordEnabled , 
320+                 PathSearchActionKeyword  =  "p" , 
321+                 SearchActionKeywordEnabled  =  searchActionKeywordEnabled , 
322+                 SearchActionKeyword  =  "e" 
323+             } ; 
324+             ResultManager . Init ( new  PluginInitContext ( ) ,  settings ) ; 
325+ 
326+             // When 
327+             var  result  =  ResultManager . GetPathWithActionKeyword ( path ,  type ,  actionKeyword ) ; 
328+ 
329+             // Then 
330+             Assert . AreEqual ( result ,  expectedResult ) ; 
331+         } 
332+ 
333+         [ TestCase ( "somefolder" ,  "c:\\ somefolder\\ " ,  ResultType . Folder ,  "q" ,  false ,  false ,  "q somefolder" ) ] 
334+         [ TestCase ( "somefolder" ,  "c:\\ somefolder\\ " ,  ResultType . Folder ,  "i" ,  true ,  false ,  "p c:\\ somefolder\\ " ) ] 
335+         [ TestCase ( "somefolder" ,  "c:\\ somefolder\\ " ,  ResultType . Folder ,  "irrelevant" ,  true ,  true ,  "c:\\ somefolder\\ " ) ] 
336+         public  void  GivenQueryWithFolderTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString ( 
337+             string  title , 
338+             string  path , 
339+             ResultType  resultType , 
340+             string  actionKeyword , 
341+             bool  pathSearchKeywordEnabled , 
342+             bool  searchActionKeywordEnabled , 
343+             string  expectedResult ) 
344+         { 
345+             // Given 
346+             var  query  =  new  Query ( )  {  ActionKeyword  =  actionKeyword  } ; 
347+             var  settings  =  new  Settings ( ) 
348+             { 
349+                 PathSearchKeywordEnabled  =  pathSearchKeywordEnabled , 
350+                 PathSearchActionKeyword  =  "p" , 
351+                 SearchActionKeywordEnabled  =  searchActionKeywordEnabled , 
352+                 SearchActionKeyword  =  Query . GlobalPluginWildcardSign , 
353+                 QuickAccessActionKeyword  =  "q" , 
354+                 IndexSearchActionKeyword  =  "i" 
355+             } ; 
356+             ResultManager . Init ( new  PluginInitContext ( ) ,  settings ) ; 
357+ 
358+             // When 
359+             var  result  =  ResultManager . GetAutoCompleteText ( title ,  query ,  path ,  resultType ) ; 
360+ 
361+             // Then 
362+             Assert . AreEqual ( result ,  expectedResult ) ; 
363+         } 
364+ 
365+         [ TestCase ( "somefile" ,  "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "q" ,  false ,  false ,  "q somefile" ) ] 
366+         [ TestCase ( "somefile" ,  "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "i" ,  true ,  false ,  "p c:\\ somefolder\\ somefile" ) ] 
367+         [ TestCase ( "somefile" ,  "c:\\ somefolder\\ somefile" ,  ResultType . File ,  "irrelevant" ,  true ,  true ,  "c:\\ somefolder\\ somefile" ) ] 
368+         public  void  GivenQueryWithFileTypeResult_WhenGetAutoComplete_ThenResultShouldBeExpectedString ( 
369+             string  title , 
370+             string  path , 
371+             ResultType  resultType , 
372+             string  actionKeyword , 
373+             bool  pathSearchKeywordEnabled , 
374+             bool  searchActionKeywordEnabled , 
375+             string  expectedResult ) 
376+         { 
377+             // Given 
378+             var  query  =  new  Query ( )  {  ActionKeyword  =  actionKeyword  } ; 
379+             var  settings  =  new  Settings ( ) 
380+             { 
381+                 QuickAccessActionKeyword  =  "q" , 
382+                 IndexSearchActionKeyword  =  "i" , 
383+                 PathSearchActionKeyword  =  "p" , 
384+                 PathSearchKeywordEnabled  =  pathSearchKeywordEnabled , 
385+                 SearchActionKeywordEnabled  =  searchActionKeywordEnabled , 
386+                 SearchActionKeyword  =  Query . GlobalPluginWildcardSign 
387+             } ; 
388+             ResultManager . Init ( new  PluginInitContext ( ) ,  settings ) ; 
389+ 
390+             // When 
391+             var  result  =  ResultManager . GetAutoCompleteText ( title ,  query ,  path ,  resultType ) ; 
392+ 
393+             // Then 
394+             Assert . AreEqual ( result ,  expectedResult ) ; 
395+         } 
272396    } 
273397} 
0 commit comments