@@ -8,21 +8,24 @@ public class NavigationServiceTests
88{
99 public class TheFindNearestMatchingLineMethod
1010 {
11- [ TestCase ( new [ ] { "line" } , new [ ] { "line" } , 0 , 0 , Description = "Match same line" ) ]
12- [ TestCase ( new [ ] { "line" } , new [ ] { "line_no_match" } , 0 , - 1 , Description = "No matching line" ) ]
13- [ TestCase ( new [ ] { "line" } , new [ ] { "" , "line" } , 0 , 1 , Description = "Match line moved up" ) ]
14- [ TestCase ( new [ ] { "" , "line" } , new [ ] { "line" } , 1 , 0 , Description = "Match line moved down" ) ]
15- [ TestCase ( new [ ] { "line" , "line" } , new [ ] { "line" , "line" } , 0 , 0 , Description = "Match nearest line" ) ]
16- [ TestCase ( new [ ] { "line" , "line" } , new [ ] { "line" , "line" } , 1 , 1 , Description = "Match nearest line" ) ]
17- [ TestCase ( new [ ] { "line" } , new [ ] { "line" } , 1 , 0 , Description = "Treat after last line the same as last line" ) ]
18- public void FindNearestMatching ( IList < string > fromLines , IList < string > toLines , int line , int expectLine )
11+ [ TestCase ( new [ ] { "line" } , new [ ] { "line" } , 0 , 0 , 1 , Description = "Match same line" ) ]
12+ [ TestCase ( new [ ] { "line" } , new [ ] { "line_no_match" } , 0 , - 1 , 0 , Description = "No matching line" ) ]
13+ [ TestCase ( new [ ] { "line" } , new [ ] { "" , "line" } , 0 , 1 , 1 , Description = "Match line moved up" ) ]
14+ [ TestCase ( new [ ] { "" , "line" } , new [ ] { "line" } , 1 , 0 , 1 , Description = "Match line moved down" ) ]
15+ [ TestCase ( new [ ] { "line" , "line" } , new [ ] { "line" , "line" } , 0 , 0 , 2 , Description = "Match nearest line" ) ]
16+ [ TestCase ( new [ ] { "line" , "line" } , new [ ] { "line" , "line" } , 1 , 1 , 2 , Description = "Match nearest line" ) ]
17+ [ TestCase ( new [ ] { "line" } , new [ ] { "line" } , 1 , 0 , 1 , Description = "Treat after last line the same as last line" ) ]
18+ public void FindNearestMatchingLine ( IList < string > fromLines , IList < string > toLines , int line ,
19+ int expectNearestLine , int expectMatchingLines )
1920 {
2021 var sp = Substitute . For < IServiceProvider > ( ) ;
2122 var target = new NavigationService ( sp ) ;
2223
23- var matchingLine = target . FindNearestMatchingLine ( fromLines , toLines , line ) ;
24+ int matchedLines ;
25+ var nearestLine = target . FindNearestMatchingLine ( fromLines , toLines , line , out matchedLines ) ;
2426
25- Assert . That ( matchingLine , Is . EqualTo ( expectLine ) ) ;
27+ Assert . That ( nearestLine , Is . EqualTo ( expectNearestLine ) ) ;
28+ Assert . That ( matchedLines , Is . EqualTo ( expectMatchingLines ) ) ;
2629 }
2730 }
2831}
0 commit comments