@@ -22,16 +22,35 @@ public void Should_Have_Start_Index_Zero()
2222 }
2323
2424 [ Theory ]
25- [ InlineData ( true ) ]
26- [ InlineData ( false ) ]
27- public void Should_Increase_Index ( bool wrap )
25+ [ InlineData ( ConsoleKey . UpArrow ) ]
26+ [ InlineData ( ConsoleKey . K ) ]
27+ public void Should_Decrease_Index ( ConsoleKey key )
28+ {
29+ // Given
30+ var state = CreateListPromptState ( 100 , 10 , false , false ) ;
31+ state . Update ( ConsoleKey . End . ToConsoleKeyInfo ( ) ) ;
32+ var index = state . Index ;
33+
34+ // When
35+ state . Update ( key . ToConsoleKeyInfo ( ) ) ;
36+
37+ // Then
38+ state . Index . ShouldBe ( index - 1 ) ;
39+ }
40+
41+ [ Theory ]
42+ [ InlineData ( ConsoleKey . DownArrow , true ) ]
43+ [ InlineData ( ConsoleKey . DownArrow , false ) ]
44+ [ InlineData ( ConsoleKey . J , true ) ]
45+ [ InlineData ( ConsoleKey . J , false ) ]
46+ public void Should_Increase_Index ( ConsoleKey key , bool wrap )
2847 {
2948 // Given
3049 var state = CreateListPromptState ( 100 , 10 , wrap , false ) ;
3150 var index = state . Index ;
3251
3352 // When
34- state . Update ( ConsoleKey . DownArrow . ToConsoleKeyInfo ( ) ) ;
53+ state . Update ( key . ToConsoleKeyInfo ( ) ) ;
3554
3655 // Then
3756 state . Index . ShouldBe ( index + 1 ) ;
@@ -52,42 +71,48 @@ public void Should_Go_To_End(bool wrap)
5271 state . Index . ShouldBe ( 99 ) ;
5372 }
5473
55- [ Fact ]
56- public void Should_Clamp_Index_If_No_Wrap ( )
74+ [ Theory ]
75+ [ InlineData ( ConsoleKey . DownArrow ) ]
76+ [ InlineData ( ConsoleKey . J ) ]
77+ public void Should_Clamp_Index_If_No_Wrap ( ConsoleKey key )
5778 {
5879 // Given
5980 var state = CreateListPromptState ( 100 , 10 , false , false ) ;
6081 state . Update ( ConsoleKey . End . ToConsoleKeyInfo ( ) ) ;
6182
6283 // When
63- state . Update ( ConsoleKey . DownArrow . ToConsoleKeyInfo ( ) ) ;
84+ state . Update ( key . ToConsoleKeyInfo ( ) ) ;
6485
6586 // Then
6687 state . Index . ShouldBe ( 99 ) ;
6788 }
6889
69- [ Fact ]
70- public void Should_Wrap_Index_If_Wrap ( )
90+ [ Theory ]
91+ [ InlineData ( ConsoleKey . DownArrow ) ]
92+ [ InlineData ( ConsoleKey . J ) ]
93+ public void Should_Wrap_Index_If_Wrap ( ConsoleKey key )
7194 {
7295 // Given
7396 var state = CreateListPromptState ( 100 , 10 , true , false ) ;
7497 state . Update ( ConsoleKey . End . ToConsoleKeyInfo ( ) ) ;
7598
7699 // When
77- state . Update ( ConsoleKey . DownArrow . ToConsoleKeyInfo ( ) ) ;
100+ state . Update ( key . ToConsoleKeyInfo ( ) ) ;
78101
79102 // Then
80103 state . Index . ShouldBe ( 0 ) ;
81104 }
82105
83- [ Fact ]
84- public void Should_Wrap_Index_If_Wrap_And_Down ( )
106+ [ Theory ]
107+ [ InlineData ( ConsoleKey . UpArrow ) ]
108+ [ InlineData ( ConsoleKey . K ) ]
109+ public void Should_Wrap_Index_If_Wrap_And_Down ( ConsoleKey key )
85110 {
86111 // Given
87112 var state = CreateListPromptState ( 100 , 10 , true , false ) ;
88113
89114 // When
90- state . Update ( ConsoleKey . UpArrow . ToConsoleKeyInfo ( ) ) ;
115+ state . Update ( key . ToConsoleKeyInfo ( ) ) ;
91116
92117 // Then
93118 state . Index . ShouldBe ( 99 ) ;
@@ -106,13 +131,15 @@ public void Should_Wrap_Index_If_Wrap_And_Page_Up()
106131 state . Index . ShouldBe ( 0 ) ;
107132 }
108133
109- [ Fact ]
110- public void Should_Wrap_Index_If_Wrap_And_Offset_And_Page_Down ( )
134+ [ Theory ]
135+ [ InlineData ( ConsoleKey . UpArrow ) ]
136+ [ InlineData ( ConsoleKey . K ) ]
137+ public void Should_Wrap_Index_If_Wrap_And_Offset_And_Page_Down ( ConsoleKey key )
111138 {
112139 // Given
113140 var state = CreateListPromptState ( 10 , 100 , true , false ) ;
114141 state . Update ( ConsoleKey . End . ToConsoleKeyInfo ( ) ) ;
115- state . Update ( ConsoleKey . UpArrow . ToConsoleKeyInfo ( ) ) ;
142+ state . Update ( key . ToConsoleKeyInfo ( ) ) ;
116143
117144 // When
118145 state . Update ( ConsoleKey . PageDown . ToConsoleKeyInfo ( ) ) ;
0 commit comments