@@ -62,12 +62,142 @@ public void should_implement_search()
62
62
{
63
63
results . ShouldContain ( "search" ) ;
64
64
}
65
+
66
+ [ Fact ]
67
+ public void should_implement_find ( )
68
+ {
69
+ results . ShouldContain ( "find" ) ;
70
+ }
65
71
}
66
72
73
+ public class when_configurating_the_argument_parser_for_list_command : ChocolateyListCommandSpecsBase
74
+ {
75
+ private OptionSet optionSet ;
76
+
77
+ public override void Context ( )
78
+ {
79
+ base . Context ( ) ;
80
+ optionSet = new OptionSet ( ) ;
81
+ configuration . CommandName = "list" ;
82
+ }
83
+
84
+ public override void Because ( )
85
+ {
86
+ command . configure_argument_parser ( optionSet , configuration ) ;
87
+ }
88
+
89
+ [ Fact ]
90
+ public void should_add_source_to_the_option_set ( )
91
+ {
92
+ optionSet . Contains ( "source" ) . ShouldBeTrue ( ) ;
93
+ }
94
+
95
+ [ Fact ]
96
+ public void should_add_short_version_of_source_to_the_option_set ( )
97
+ {
98
+ optionSet . Contains ( "s" ) . ShouldBeTrue ( ) ;
99
+ }
100
+
101
+ [ Fact , Obsolete ( "Local Only will be removed in v2.0.0 for the list command" ) ]
102
+ public void should_add_localonly_to_the_option_set ( )
103
+ {
104
+ optionSet . Contains ( "localonly" ) . ShouldBeTrue ( ) ;
105
+ }
106
+
107
+ [ Fact , Obsolete ( "Local Only will be removed in v2.0.0 for the list command" ) ]
108
+ public void should_add_short_version_of_localonly_to_the_option_set ( )
109
+ {
110
+ optionSet . Contains ( "l" ) . ShouldBeTrue ( ) ;
111
+ }
112
+
113
+ [ NUnit . Framework . Theory ]
114
+ [ NUnit . Framework . TestCase ( "localonly" ) ]
115
+ [ NUnit . Framework . TestCase ( "source" ) ]
116
+ [ NUnit . Framework . TestCase ( "user" ) ]
117
+ [ NUnit . Framework . TestCase ( "password" ) ]
118
+ [ NUnit . Framework . TestCase ( "cert" ) ]
119
+ [ NUnit . Framework . TestCase ( "certpassword" ) ]
120
+ [ NUnit . Framework . TestCase ( "approved-only" ) ]
121
+ [ NUnit . Framework . TestCase ( "download-cache-only" ) ]
122
+ [ NUnit . Framework . TestCase ( "disable-package-repository-optimizations" ) ]
123
+ [ Obsolete ( "Will be removed in v2.0.0 for the list command" ) ]
124
+ public void should_add_deprecation_notice_to_option ( string argument )
125
+ {
126
+ optionSet [ argument ] . Description . ShouldContain ( "DEPRECATION NOTICE" ) ;
127
+ }
128
+
129
+ [ Fact ]
130
+ public void should_add_prerelease_to_the_option_set ( )
131
+ {
132
+ optionSet . Contains ( "prerelease" ) . ShouldBeTrue ( ) ;
133
+ }
134
+
135
+ [ Fact ]
136
+ public void should_add_short_version_of_prerelease_to_the_option_set ( )
137
+ {
138
+ optionSet . Contains ( "pre" ) . ShouldBeTrue ( ) ;
139
+ }
140
+
141
+ [ Fact ]
142
+ public void should_add_includeprograms_to_the_option_set ( )
143
+ {
144
+ optionSet . Contains ( "includeprograms" ) . ShouldBeTrue ( ) ;
145
+ }
146
+
147
+ [ Fact ]
148
+ public void should_add_short_version_of_includeprograms_to_the_option_set ( )
149
+ {
150
+ optionSet . Contains ( "i" ) . ShouldBeTrue ( ) ;
151
+ }
152
+
153
+ [ Fact ]
154
+ public void should_add_allversions_to_the_option_set ( )
155
+ {
156
+ optionSet . Contains ( "allversions" ) . ShouldBeTrue ( ) ;
157
+ }
158
+
159
+ [ Fact ]
160
+ public void should_add_short_version_of_allversions_to_the_option_set ( )
161
+ {
162
+ optionSet . Contains ( "a" ) . ShouldBeTrue ( ) ;
163
+ }
164
+
165
+ [ Fact , Obsolete ( "Will be removed in v2.0.0" ) ]
166
+ public void should_add_user_to_the_option_set ( )
167
+ {
168
+ optionSet . Contains ( "user" ) . ShouldBeTrue ( ) ;
169
+ }
170
+
171
+ [ Fact , Obsolete ( "Will be removed in v2.0.0" ) ]
172
+ public void should_add_short_version_of_user_to_the_option_set ( )
173
+ {
174
+ optionSet . Contains ( "u" ) . ShouldBeTrue ( ) ;
175
+ }
176
+
177
+ [ Fact , Obsolete ( "Will be removed in v2.0.0" ) ]
178
+ public void should_add_password_to_the_option_set ( )
179
+ {
180
+ optionSet . Contains ( "password" ) . ShouldBeTrue ( ) ;
181
+ }
182
+
183
+ [ Fact , Obsolete ( "Will be removed in v2.0.0" ) ]
184
+ public void should_add_short_version_of_password_to_the_option_set ( )
185
+ {
186
+ optionSet . Contains ( "p" ) . ShouldBeTrue ( ) ;
187
+ }
188
+ }
189
+
190
+ [ NUnit . Framework . TestFixture ( "search" ) ]
191
+ [ NUnit . Framework . TestFixture ( "find" ) ]
67
192
public class when_configurating_the_argument_parser : ChocolateyListCommandSpecsBase
68
193
{
69
194
private OptionSet optionSet ;
70
195
196
+ public when_configurating_the_argument_parser ( string commandName )
197
+ {
198
+ configuration . CommandName = commandName ;
199
+ }
200
+
71
201
public override void Context ( )
72
202
{
73
203
base . Context ( ) ;
@@ -162,6 +292,21 @@ public void should_add_short_version_of_password_to_the_option_set()
162
292
{
163
293
optionSet . Contains ( "p" ) . ShouldBeTrue ( ) ;
164
294
}
295
+
296
+ [ NUnit . Framework . Theory ]
297
+ [ NUnit . Framework . TestCase ( "localonly" ) ]
298
+ [ NUnit . Framework . TestCase ( "source" ) ]
299
+ [ NUnit . Framework . TestCase ( "user" ) ]
300
+ [ NUnit . Framework . TestCase ( "password" ) ]
301
+ [ NUnit . Framework . TestCase ( "cert" ) ]
302
+ [ NUnit . Framework . TestCase ( "certpassword" ) ]
303
+ [ NUnit . Framework . TestCase ( "approved-only" ) ]
304
+ [ NUnit . Framework . TestCase ( "download-cache-only" ) ]
305
+ [ NUnit . Framework . TestCase ( "disable-package-repository-optimizations" ) ]
306
+ public void should_add_deprecation_notice_to_option ( string argument )
307
+ {
308
+ optionSet [ argument ] . Description . ShouldNotContain ( "DEPRECATION NOTICE" ) ;
309
+ }
165
310
}
166
311
167
312
public class when_handling_additional_argument_parsing : ChocolateyListCommandSpecsBase
@@ -199,6 +344,61 @@ public void should_leave_source_as_set()
199
344
}
200
345
}
201
346
347
+ public class when_noop_is_called_with_list_command : ChocolateyListCommandSpecsBase
348
+ {
349
+ public override void Context ( )
350
+ {
351
+ base . Context ( ) ;
352
+ configuration . CommandName = "list" ;
353
+ }
354
+
355
+ public override void Because ( )
356
+ {
357
+ command . noop ( configuration ) ;
358
+ }
359
+
360
+ [ Fact ]
361
+ public void should_call_service_list_noop ( )
362
+ {
363
+ packageService . Verify ( c => c . list_noop ( configuration ) , Times . Once ) ;
364
+ }
365
+
366
+ [ Fact ]
367
+ public void should_report_deprecation_of_remote_sources ( )
368
+ {
369
+ MockLogger . Messages . Keys . ShouldContain ( "Warn" ) ;
370
+ MockLogger . Messages [ "Warn" ] . ShouldContain ( @"Using list with remote sources is deprecated and will be made local only in v2.0.0,
371
+ use the commands search or find instead for remote sources." ) ;
372
+ }
373
+ }
374
+
375
+ public class when_noop_is_called_with_list_command_and_local_only : ChocolateyListCommandSpecsBase
376
+ {
377
+ public override void Context ( )
378
+ {
379
+ base . Context ( ) ;
380
+ configuration . CommandName = "list" ;
381
+ configuration . ListCommand . LocalOnly = true ;
382
+ }
383
+
384
+ public override void Because ( )
385
+ {
386
+ command . noop ( configuration ) ;
387
+ }
388
+
389
+ [ Fact ]
390
+ public void should_call_service_list_noop ( )
391
+ {
392
+ packageService . Verify ( c => c . list_noop ( configuration ) , Times . Once ) ;
393
+ }
394
+
395
+ [ Fact ]
396
+ public void should_not_report_any_warning_messages ( )
397
+ {
398
+ MockLogger . Messages . Keys . ShouldNotContain ( "Warn" ) ;
399
+ }
400
+ }
401
+
202
402
public class when_noop_is_called : ChocolateyListCommandSpecsBase
203
403
{
204
404
public override void Because ( )
@@ -211,6 +411,67 @@ public void should_call_service_list_noop()
211
411
{
212
412
packageService . Verify ( c => c . list_noop ( configuration ) , Times . Once ) ;
213
413
}
414
+
415
+ [ Fact ]
416
+ public void should_not_report_any_warning_messages ( )
417
+ {
418
+ MockLogger . Messages . Keys . ShouldNotContain ( "Warn" ) ;
419
+ }
420
+ }
421
+
422
+ public class when_run_is_called_with_list_command : ChocolateyListCommandSpecsBase
423
+ {
424
+ public override void Context ( )
425
+ {
426
+ base . Context ( ) ;
427
+ configuration . CommandName = "list" ;
428
+ }
429
+
430
+ public override void Because ( )
431
+ {
432
+ command . run ( configuration ) ;
433
+ }
434
+
435
+ [ Fact ]
436
+ public void should_call_service_list_run ( )
437
+ {
438
+ packageService . Verify ( c => c . list_run ( configuration ) , Times . Once ) ;
439
+ }
440
+
441
+ [ Fact ]
442
+ public void should_not_report_any_warning_messages ( )
443
+ {
444
+ MockLogger . Messages . Keys . ShouldContain ( "Warn" ) ;
445
+ MockLogger . Messages [ "Warn" ] . ShouldContain ( @"Using list with remote sources is deprecated and will be made local only in v2.0.0,
446
+ use the commands search or find instead for remote sources." ) ;
447
+ }
448
+ }
449
+
450
+ public class when_run_is_called_with_list_command_and_local_only : ChocolateyListCommandSpecsBase
451
+ {
452
+ public override void Context ( )
453
+ {
454
+ base . Context ( ) ;
455
+ configuration . CommandName = "list" ;
456
+ configuration . ListCommand . LocalOnly = true ;
457
+ }
458
+
459
+ public override void Because ( )
460
+ {
461
+ command . run ( configuration ) ;
462
+ }
463
+
464
+ [ Fact ]
465
+ public void should_call_service_list_run ( )
466
+ {
467
+ packageService . Verify ( c => c . list_run ( configuration ) , Times . Once ) ;
468
+ }
469
+
470
+ [ Fact ]
471
+ public void should_not_report_any_warning_messages ( )
472
+ {
473
+ MockLogger . Messages . Keys . ShouldNotContain ( "Warn" ) ;
474
+ }
214
475
}
215
476
216
477
public class when_run_is_called : ChocolateyListCommandSpecsBase
@@ -225,6 +486,62 @@ public void should_call_service_list_run()
225
486
{
226
487
packageService . Verify ( c => c . list_run ( configuration ) , Times . Once ) ;
227
488
}
489
+
490
+ [ Fact ]
491
+ public void should_not_report_any_warning_messages ( )
492
+ {
493
+ MockLogger . Messages . Keys . ShouldNotContain ( "Warn" ) ;
494
+ }
495
+ }
496
+
497
+ public class when_outputting_help_message_for_list_command : ChocolateyListCommandSpecsBase
498
+ {
499
+ public override void Context ( )
500
+ {
501
+ base . Context ( ) ;
502
+ configuration . CommandName = "list" ;
503
+ }
504
+
505
+ public override void Because ( )
506
+ {
507
+ command . help_message ( configuration ) ;
508
+ }
509
+
510
+ [ Fact , Obsolete ( "Will be removed in v2.0.0" ) ]
511
+ public void should_output_deprecation_notice_header ( )
512
+ {
513
+ MockLogger . Messages . Keys . ShouldContain ( "Warn" ) ;
514
+ MockLogger . Messages [ "Warn" ] . ShouldContain ( "DEPRECATION NOTICE" ) ;
515
+ }
516
+
517
+ [ Fact ]
518
+ public void should_ouput_removal_in_v2_0_0 ( )
519
+ {
520
+ MockLogger . Messages . Keys . ShouldContain ( "Warn" ) ;
521
+ MockLogger . Messages [ "Warn" ] . ShouldContain ( @"
522
+ Will be removed for the list command in v2.0.0." ) ;
523
+ }
524
+ }
525
+
526
+ [ NUnit . Framework . TestFixture ( "search" ) ]
527
+ [ NUnit . Framework . TestFixture ( "find" ) ]
528
+ public class when_outputting_help_message : ChocolateyListCommandSpecsBase
529
+ {
530
+ public when_outputting_help_message ( string commandName )
531
+ {
532
+ configuration . CommandName = commandName ;
533
+ }
534
+
535
+ public override void Because ( )
536
+ {
537
+ command . help_message ( configuration ) ;
538
+ }
539
+
540
+ [ Fact ]
541
+ public void should_not_output_warnings ( )
542
+ {
543
+ MockLogger . Messages . Keys . ShouldNotContain ( "Warn" ) ;
544
+ }
228
545
}
229
546
}
230
547
}
0 commit comments