8
8
using CommandLine . Tests . Fakes ;
9
9
using FluentAssertions ;
10
10
using Xunit ;
11
+ using CommandLine . Text ;
11
12
12
13
namespace CommandLine . Tests . Unit
13
14
{
@@ -326,7 +327,7 @@ public void Explicit_version_request_generates_version_requested_error()
326
327
// Teardown
327
328
}
328
329
329
- // [Fact]
330
+ [ Fact ]
330
331
public void Explicit_version_request_generates_version_info_screen ( )
331
332
{
332
333
// Fixture setup
@@ -340,17 +341,12 @@ public void Explicit_version_request_generates_version_info_screen()
340
341
// Verify outcome
341
342
result . Length . Should ( ) . BeGreaterThan ( 0 ) ;
342
343
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
343
- lines . Should ( ) . HaveCount ( x => x == 1 ) ;
344
- #if ! PLATFORM_DOTNET
345
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
346
- #else
347
- // Takes the name of the xUnit test program
348
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
349
- #endif
344
+ lines . Should ( ) . HaveCount ( x => x == 1 ) ;
345
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
350
346
// Teardown
351
347
}
352
348
353
- // [Fact]
349
+ [ Fact ]
354
350
public void Implicit_help_screen_in_verb_scenario ( )
355
351
{
356
352
// Fixture setup
@@ -364,14 +360,8 @@ public void Implicit_help_screen_in_verb_scenario()
364
360
// Verify outcome
365
361
result . Length . Should ( ) . BeGreaterThan ( 0 ) ;
366
362
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
367
- #if ! PLATFORM_DOTNET
368
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
369
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
370
- #else
371
- // Takes the name of the xUnit test program
372
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
373
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
374
- #endif
363
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
364
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
375
365
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "ERROR(S):" ) ;
376
366
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "No verb selected." ) ;
377
367
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "add Add file contents to the index." ) ;
@@ -382,7 +372,7 @@ public void Implicit_help_screen_in_verb_scenario()
382
372
// Teardown
383
373
}
384
374
385
- // [Fact]
375
+ [ Fact ]
386
376
public void Double_dash_help_dispalys_verbs_index_in_verbs_scenario ( )
387
377
{
388
378
// Fixture setup
@@ -395,14 +385,8 @@ public void Double_dash_help_dispalys_verbs_index_in_verbs_scenario()
395
385
396
386
// Verify outcome
397
387
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
398
- #if ! PLATFORM_DOTNET
399
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
400
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
401
- #else
402
- // Takes the name of the xUnit test program
403
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
404
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
405
- #endif
388
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
389
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
406
390
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "add Add file contents to the index." ) ;
407
391
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "commit Record changes to the repository." ) ;
408
392
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "clone Clone a repository into a new directory." ) ;
@@ -411,7 +395,7 @@ public void Double_dash_help_dispalys_verbs_index_in_verbs_scenario()
411
395
// Teardown
412
396
}
413
397
414
- // [Theory]
398
+ [ Theory ]
415
399
[ InlineData ( "--version" ) ]
416
400
[ InlineData ( "version" ) ]
417
401
public void Explicit_version_request_generates_version_info_screen_in_verbs_scenario ( string command )
@@ -428,16 +412,11 @@ public void Explicit_version_request_generates_version_info_screen_in_verbs_scen
428
412
result . Length . Should ( ) . BeGreaterThan ( 0 ) ;
429
413
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
430
414
lines . Should ( ) . HaveCount ( x => x == 1 ) ;
431
- #if ! PLATFORM_DOTNET
432
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
433
- #else
434
- // Takes the name of the xUnit test program
435
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
436
- #endif
415
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
437
416
// Teardown
438
417
}
439
418
440
- // [Fact]
419
+ [ Fact ]
441
420
public void Errors_of_type_MutuallyExclusiveSetError_are_properly_formatted ( )
442
421
{
443
422
// Fixture setup
@@ -450,14 +429,8 @@ public void Errors_of_type_MutuallyExclusiveSetError_are_properly_formatted()
450
429
451
430
// Verify outcome
452
431
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
453
- #if ! PLATFORM_DOTNET
454
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
455
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
456
- #else
457
- // Takes the name of the xUnit test program
458
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
459
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
460
- #endif
432
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
433
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
461
434
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "ERROR(S):" ) ;
462
435
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "Option: 'weburl' is not compatible with: 'ftpurl'." ) ;
463
436
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "Option: 'ftpurl' is not compatible with: 'weburl'." ) ;
@@ -485,7 +458,7 @@ public void Explicit_help_request_with_specific_verb_generates_help_screen()
485
458
// Teardown
486
459
}
487
460
488
- // [Fact]
461
+ [ Fact ]
489
462
public void Properly_formatted_help_screen_is_displayed_when_usage_is_defined_in_verb_scenario ( )
490
463
{
491
464
// Fixture setup
@@ -503,14 +476,8 @@ public void Properly_formatted_help_screen_is_displayed_when_usage_is_defined_in
503
476
504
477
// Verify outcome
505
478
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
506
- #if ! PLATFORM_DOTNET
507
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
508
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
509
- #else
510
- // Takes the name of the xUnit test program
511
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
512
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
513
- #endif
479
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
480
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
514
481
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "ERROR(S):" ) ;
515
482
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "Option 'badoption' is unknown." ) ;
516
483
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "USAGE:" ) ;
@@ -530,7 +497,7 @@ public void Properly_formatted_help_screen_is_displayed_when_usage_is_defined_in
530
497
// Teardown
531
498
}
532
499
533
- // [Fact]
500
+ [ Fact ]
534
501
public void Properly_formatted_help_screen_is_displayed_when_there_is_a_hidden_verb ( )
535
502
{
536
503
// Fixture setup
@@ -543,14 +510,8 @@ public void Properly_formatted_help_screen_is_displayed_when_there_is_a_hidden_v
543
510
544
511
// Verify outcome
545
512
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
546
- #if ! PLATFORM_DOTNET
547
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
548
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
549
- #else
550
- // Takes the name of the xUnit test program
551
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
552
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
553
- #endif
513
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
514
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
554
515
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "ERROR(S):" ) ;
555
516
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "No verb selected." ) ;
556
517
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "add Add file contents to the index." ) ;
@@ -560,7 +521,7 @@ public void Properly_formatted_help_screen_is_displayed_when_there_is_a_hidden_v
560
521
// Teardown
561
522
}
562
523
563
- // [Fact]
524
+ [ Fact ]
564
525
public void Properly_formatted_help_screen_is_displayed_when_there_is_a_hidden_verb_selected_usage_displays_with_hidden_option ( )
565
526
{
566
527
// Fixture setup
@@ -573,14 +534,8 @@ public void Properly_formatted_help_screen_is_displayed_when_there_is_a_hidden_v
573
534
574
535
// Verify outcome
575
536
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
576
- #if ! PLATFORM_DOTNET
577
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
578
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
579
- #else
580
- // Takes the name of the xUnit test program
581
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
582
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
583
- #endif
537
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
538
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
584
539
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "-f, --force Allow adding otherwise ignored files." ) ;
585
540
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "--help Display this help screen." ) ;
586
541
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "--version Display version information." ) ;
@@ -627,7 +582,7 @@ public void Parse_options_when_given_hidden_verb_with_hidden_option()
627
582
// Teardown
628
583
}
629
584
630
- // [Fact]
585
+ [ Fact ]
631
586
public void Specific_verb_help_screen_should_be_displayed_regardless_other_argument ( )
632
587
{
633
588
// Fixture setup
@@ -645,14 +600,8 @@ public void Specific_verb_help_screen_should_be_displayed_regardless_other_argum
645
600
646
601
// Verify outcome
647
602
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
648
- #if ! PLATFORM_DOTNET
649
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
650
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
651
- #else
652
- // Takes the name of the xUnit test program
653
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
654
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
655
- #endif
603
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
604
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
656
605
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "--no-hardlinks Optimize the cloning process from a repository on a local" ) ;
657
606
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "filesystem by copying files." ) ;
658
607
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "-q, --quiet Suppress summary message." ) ;
@@ -701,7 +650,7 @@ public void When_IgnoreUnknownArguments_is_set_valid_unknown_arguments_avoid_a_f
701
650
// Teardown
702
651
}
703
652
704
- // [Fact]
653
+ [ Fact ]
705
654
public void Properly_formatted_help_screen_excludes_help_as_unknown_option ( )
706
655
{
707
656
// Fixture setup
@@ -719,14 +668,8 @@ public void Properly_formatted_help_screen_excludes_help_as_unknown_option()
719
668
720
669
// Verify outcome
721
670
var lines = result . ToNotEmptyLines ( ) . TrimStringArray ( ) ;
722
- #if ! PLATFORM_DOTNET
723
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "CommandLine" ) ;
724
- lines [ 1 ] . Should ( ) . BeEquivalentTo ( "Copyright (c) 2005 - 2018 Giacomo Stelluti Scala & Contributors" ) ;
725
- #else
726
- // Takes the name of the xUnit test program
727
- lines [ 0 ] . Should ( ) . StartWithEquivalent ( "xUnit" ) ;
728
- lines [ 1 ] . Should ( ) . StartWithEquivalent ( "Copyright (C) Outercurve Foundation" ) ;
729
- #endif
671
+ lines [ 0 ] . Should ( ) . Be ( HeadingInfo . Default . ToString ( ) ) ;
672
+ lines [ 1 ] . Should ( ) . Be ( CopyrightInfo . Default . ToString ( ) ) ;
730
673
lines [ 2 ] . Should ( ) . BeEquivalentTo ( "ERROR(S):" ) ;
731
674
lines [ 3 ] . Should ( ) . BeEquivalentTo ( "Option 'bad-arg' is unknown." ) ;
732
675
lines [ 4 ] . Should ( ) . BeEquivalentTo ( "--no-hardlinks Optimize the cloning process from a repository on a local" ) ;
0 commit comments