@@ -7,183 +7,183 @@ public class ListOpsTests
77 [ Fact ]
88 public void Append_entries_to_a_list_and_return_the_new_list_empty_lists ( )
99 {
10- var list1 = new List < int > ( ) ;
11- var list2 = new List < int > ( ) ;
10+ List < int > list1 = [ ] ;
11+ List < int > list2 = [ ] ;
1212 Assert . Empty ( ListOps . Append ( list1 , list2 ) ) ;
1313 }
1414
1515 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
1616 public void Append_entries_to_a_list_and_return_the_new_list_list_to_empty_list ( )
1717 {
18- var list1 = new List < int > ( ) ;
19- var list2 = new List < int > { 1 , 2 , 3 , 4 } ;
20- var expected = new List < int > { 1 , 2 , 3 , 4 } ;
18+ List < int > list1 = [ ] ;
19+ List < int > list2 = [ 1 , 2 , 3 , 4 ] ;
20+ List < int > expected = [ 1 , 2 , 3 , 4 ] ;
2121 Assert . Equal ( expected , ListOps . Append ( list1 , list2 ) ) ;
2222 }
2323
2424 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
2525 public void Append_entries_to_a_list_and_return_the_new_list_empty_list_to_list ( )
2626 {
27- var list1 = new List < int > { 1 , 2 , 3 , 4 } ;
28- var list2 = new List < int > ( ) ;
29- var expected = new List < int > { 1 , 2 , 3 , 4 } ;
27+ List < int > list1 = [ 1 , 2 , 3 , 4 ] ;
28+ List < int > list2 = [ ] ;
29+ List < int > expected = [ 1 , 2 , 3 , 4 ] ;
3030 Assert . Equal ( expected , ListOps . Append ( list1 , list2 ) ) ;
3131 }
3232
3333 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
3434 public void Append_entries_to_a_list_and_return_the_new_list_non_empty_lists ( )
3535 {
36- var list1 = new List < int > { 1 , 2 } ;
37- var list2 = new List < int > { 2 , 3 , 4 , 5 } ;
38- var expected = new List < int > { 1 , 2 , 2 , 3 , 4 , 5 } ;
36+ List < int > list1 = [ 1 , 2 ] ;
37+ List < int > list2 = [ 2 , 3 , 4 , 5 ] ;
38+ List < int > expected = [ 1 , 2 , 2 , 3 , 4 , 5 ] ;
3939 Assert . Equal ( expected , ListOps . Append ( list1 , list2 ) ) ;
4040 }
4141
4242 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
4343 public void Concatenate_a_list_of_lists_empty_list ( )
4444 {
45- var lists = new List < List < int > > ( ) ;
45+ List < List < int > > lists = [ ] ;
4646 Assert . Empty ( ListOps . Concat ( lists ) ) ;
4747 }
4848
4949 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
5050 public void Concatenate_a_list_of_lists_list_of_lists ( )
5151 {
52- var lists = new List < List < int > > { new List < int > { 1 , 2 } , new List < int > { 3 } , new List < int > ( ) , new List < int > { 4 , 5 , 6 } } ;
53- var expected = new List < int > { 1 , 2 , 3 , 4 , 5 , 6 } ;
52+ List < List < int > > lists = [ [ 1 , 2 ] , [ 3 ] , [ ] , [ 4 , 5 , 6 ] ] ;
53+ List < int > expected = [ 1 , 2 , 3 , 4 , 5 , 6 ] ;
5454 Assert . Equal ( expected , ListOps . Concat ( lists ) ) ;
5555 }
5656
5757 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
5858 public void Concatenate_a_list_of_lists_list_of_nested_lists ( )
5959 {
60- var lists = new List < List < List < int > > > { new List < List < int > > { new List < int > { 1 } , new List < int > { 2 } } , new List < List < int > > { new List < int > { 3 } } , new List < List < int > > { new List < int > ( ) } , new List < List < int > > { new List < int > { 4 , 5 , 6 } } } ;
61- var expected = new List < List < int > > { new List < int > { 1 } , new List < int > { 2 } , new List < int > { 3 } , new List < int > ( ) , new List < int > { 4 , 5 , 6 } } ;
60+ List < List < List < int > > > lists = [ [ [ 1 ] , [ 2 ] ] , [ [ 3 ] ] , [ [ ] ] , [ [ 4 , 5 , 6 ] ] ] ;
61+ List < List < int > > expected = [ [ 1 ] , [ 2 ] , [ 3 ] , [ ] , [ 4 , 5 , 6 ] ] ;
6262 Assert . Equal ( expected , ListOps . Concat ( lists ) ) ;
6363 }
6464
6565 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
6666 public void Filter_list_returning_only_values_that_satisfy_the_filter_function_empty_list ( )
6767 {
68- var list = new List < int > ( ) ;
69- var function = new Func < int , bool > ( ( x ) => x % 2 == 1 ) ;
68+ List < int > list = [ ] ;
69+ Func < int , bool > function = ( x ) => x % 2 == 1 ;
7070 Assert . Empty ( ListOps . Filter ( list , function ) ) ;
7171 }
7272
7373 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
7474 public void Filter_list_returning_only_values_that_satisfy_the_filter_function_non_empty_list ( )
7575 {
76- var list = new List < int > { 1 , 2 , 3 , 5 } ;
77- var function = new Func < int , bool > ( ( x ) => x % 2 == 1 ) ;
78- var expected = new List < int > { 1 , 3 , 5 } ;
76+ List < int > list = [ 1 , 2 , 3 , 5 ] ;
77+ Func < int , bool > function = ( x ) => x % 2 == 1 ;
78+ List < int > expected = [ 1 , 3 , 5 ] ;
7979 Assert . Equal ( expected , ListOps . Filter ( list , function ) ) ;
8080 }
8181
8282 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
8383 public void Returns_the_length_of_a_list_empty_list ( )
8484 {
85- var list = new List < int > ( ) ;
85+ List < int > list = [ ] ;
8686 Assert . Equal ( 0 , ListOps . Length ( list ) ) ;
8787 }
8888
8989 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
9090 public void Returns_the_length_of_a_list_non_empty_list ( )
9191 {
92- var list = new List < int > { 1 , 2 , 3 , 4 } ;
92+ List < int > list = [ 1 , 2 , 3 , 4 ] ;
9393 Assert . Equal ( 4 , ListOps . Length ( list ) ) ;
9494 }
9595
9696 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
9797 public void Return_a_list_of_elements_whose_values_equal_the_list_value_transformed_by_the_mapping_function_empty_list ( )
9898 {
99- var list = new List < int > ( ) ;
100- var function = new Func < int , int > ( ( x ) => x + 1 ) ;
99+ List < int > list = [ ] ;
100+ Func < int , int > function = ( x ) => x + 1 ;
101101 Assert . Empty ( ListOps . Map ( list , function ) ) ;
102102 }
103103
104104 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
105105 public void Return_a_list_of_elements_whose_values_equal_the_list_value_transformed_by_the_mapping_function_non_empty_list ( )
106106 {
107- var list = new List < int > { 1 , 3 , 5 , 7 } ;
108- var function = new Func < int , int > ( ( x ) => x + 1 ) ;
109- var expected = new List < int > { 2 , 4 , 6 , 8 } ;
107+ List < int > list = [ 1 , 3 , 5 , 7 ] ;
108+ Func < int , int > function = ( x ) => x + 1 ;
109+ List < int > expected = [ 2 , 4 , 6 , 8 ] ;
110110 Assert . Equal ( expected , ListOps . Map ( list , function ) ) ;
111111 }
112112
113113 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
114114 public void Folds_reduces_the_given_list_from_the_left_with_a_function_direction_dependent_function_applied_to_non_empty_list ( )
115115 {
116- var list = new List < int > { 2 , 5 } ;
117- var initial = 5 ;
118- var function = new Func < int , int , int > ( ( x , y ) => x / y ) ;
116+ List < int > list = [ 2 , 5 ] ;
117+ int initial = 5 ;
118+ Func < int , int , int > function = ( x , y ) => x / y ;
119119 Assert . Equal ( 0 , ListOps . Foldl ( list , initial , function ) ) ;
120120 }
121121
122122 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
123123 public void Folds_reduces_the_given_list_from_the_left_with_a_function_empty_list ( )
124124 {
125- var list = new List < int > ( ) ;
126- var initial = 2 ;
127- var function = new Func < int , int , int > ( ( acc , el ) => el * acc ) ;
125+ List < int > list = [ ] ;
126+ int initial = 2 ;
127+ Func < int , int , int > function = ( acc , el ) => el * acc ;
128128 Assert . Equal ( 2 , ListOps . Foldl ( list , initial , function ) ) ;
129129 }
130130
131131 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
132132 public void Folds_reduces_the_given_list_from_the_left_with_a_function_direction_independent_function_applied_to_non_empty_list ( )
133133 {
134- var list = new List < int > { 1 , 2 , 3 , 4 } ;
135- var initial = 5 ;
136- var function = new Func < int , int , int > ( ( acc , el ) => el + acc ) ;
134+ List < int > list = [ 1 , 2 , 3 , 4 ] ;
135+ int initial = 5 ;
136+ Func < int , int , int > function = ( acc , el ) => el + acc ;
137137 Assert . Equal ( 15 , ListOps . Foldl ( list , initial , function ) ) ;
138138 }
139139
140140 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
141141 public void Folds_reduces_the_given_list_from_the_right_with_a_function_direction_dependent_function_applied_to_non_empty_list ( )
142142 {
143- var list = new List < int > { 2 , 5 } ;
144- var initial = 5 ;
145- var function = new Func < int , int , int > ( ( x , y ) => x / y ) ;
143+ List < int > list = [ 2 , 5 ] ;
144+ int initial = 5 ;
145+ Func < int , int , int > function = ( x , y ) => x / y ;
146146 Assert . Equal ( 2 , ListOps . Foldr ( list , initial , function ) ) ;
147147 }
148148
149149 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
150150 public void Folds_reduces_the_given_list_from_the_right_with_a_function_empty_list ( )
151151 {
152- var list = new List < int > ( ) ;
153- var initial = 2 ;
154- var function = new Func < int , int , int > ( ( acc , el ) => el * acc ) ;
152+ List < int > list = [ ] ;
153+ int initial = 2 ;
154+ Func < int , int , int > function = ( acc , el ) => el * acc ;
155155 Assert . Equal ( 2 , ListOps . Foldr ( list , initial , function ) ) ;
156156 }
157157
158158 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
159159 public void Folds_reduces_the_given_list_from_the_right_with_a_function_direction_independent_function_applied_to_non_empty_list ( )
160160 {
161- var list = new List < int > { 1 , 2 , 3 , 4 } ;
162- var initial = 5 ;
163- var function = new Func < int , int , int > ( ( acc , el ) => el + acc ) ;
161+ List < int > list = [ 1 , 2 , 3 , 4 ] ;
162+ int initial = 5 ;
163+ Func < int , int , int > function = ( acc , el ) => el + acc ;
164164 Assert . Equal ( 15 , ListOps . Foldr ( list , initial , function ) ) ;
165165 }
166166
167167 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
168168 public void Reverse_the_elements_of_the_list_empty_list ( )
169169 {
170- var list = new List < int > ( ) ;
170+ List < int > list = [ ] ;
171171 Assert . Empty ( ListOps . Reverse ( list ) ) ;
172172 }
173173
174174 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
175175 public void Reverse_the_elements_of_the_list_non_empty_list ( )
176176 {
177- var list = new List < int > { 1 , 3 , 5 , 7 } ;
178- var expected = new List < int > { 7 , 5 , 3 , 1 } ;
177+ List < int > list = [ 1 , 3 , 5 , 7 ] ;
178+ List < int > expected = [ 7 , 5 , 3 , 1 ] ;
179179 Assert . Equal ( expected , ListOps . Reverse ( list ) ) ;
180180 }
181181
182182 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
183183 public void Reverse_the_elements_of_the_list_list_of_lists_is_not_flattened ( )
184184 {
185- var list = new List < List < int > > { new List < int > { 1 , 2 } , new List < int > { 3 } , new List < int > ( ) , new List < int > { 4 , 5 , 6 } } ;
186- var expected = new List < List < int > > { new List < int > { 4 , 5 , 6 } , new List < int > ( ) , new List < int > { 3 } , new List < int > { 1 , 2 } } ;
185+ List < List < int > > list = [ [ 1 , 2 ] , [ 3 ] , [ ] , [ 4 , 5 , 6 ] ] ;
186+ List < List < int > > expected = [ [ 4 , 5 , 6 ] , [ ] , [ 3 ] , [ 1 , 2 ] ] ;
187187 Assert . Equal ( expected , ListOps . Reverse ( list ) ) ;
188188 }
189189}
0 commit comments