1
1
using System ;
2
2
using System . IO ;
3
3
using System . Threading . Tasks ;
4
- using FluentAssertions ;
4
+ using Shouldly ;
5
5
using NSubstitute ;
6
6
using NUnit . Framework ;
7
7
using Octopus . CommandLine ;
@@ -32,11 +32,10 @@ public void SetUp()
32
32
logger = new LoggerConfiguration ( ) . WriteTo . TextWriter ( output ) . CreateLogger ( ) ;
33
33
commandOutputProvider = new CommandOutputProvider ( "TestApp" , "1.0.0" , new DefaultCommandOutputJsonSerializer ( ) , logger ) ;
34
34
commandLocator . List ( )
35
- . Returns ( new ICommandMetadata [ ]
36
- {
35
+ . Returns ( [
37
36
new CommandAttribute ( "test" ) ,
38
37
new CommandAttribute ( "help" )
39
- } ) ;
38
+ ] ) ;
40
39
var helpCommand = new HelpCommand ( new Lazy < ICommandLocator > ( ( ) => commandLocator ) , commandOutputProvider ) ;
41
40
var testCommand = new TestCommand ( commandOutputProvider ) ;
42
41
commandLocator . Find ( "help" ) . Returns ( helpCommand ) ;
@@ -47,59 +46,59 @@ public void SetUp()
47
46
[ Test ]
48
47
public async Task ShouldReturnSubCommandSuggestions ( )
49
48
{
50
- await completeCommand . Execute ( new [ ] { "he" } ) ;
51
-
49
+ await completeCommand . Execute ( [ "he" ] ) ;
52
50
output . ToString ( )
53
- . Should ( )
54
- . Contain ( "help" )
55
- . And . NotContain ( "test" ) ;
51
+ . ShouldSatisfyAllConditions (
52
+ actual => actual . ShouldContain ( "help" ) ,
53
+ actual => actual . ShouldNotContain ( "test" )
54
+ ) ;
56
55
}
57
56
58
57
[ Test ]
59
58
public async Task ShouldReturnParameterSuggestions ( )
60
59
{
61
- await completeCommand . Execute ( new [ ] { "test" , "--ap" } ) ;
60
+ await completeCommand . Execute ( [ "test" , "--ap" ] ) ;
62
61
output . ToString ( )
63
- . Should ( )
64
- . Contain ( "--apiKey" ) ;
62
+ . ShouldContain ( "--apiKey" ) ;
65
63
}
66
64
67
65
[ Test ]
68
66
public async Task ShouldReturnCommonOptionsWhenSingleEmptyParameter ( )
69
67
{
70
- await completeCommand . Execute ( new [ ] { "--" } ) ;
68
+ await completeCommand . Execute ( [ "--" ] ) ;
71
69
output . ToString ( )
72
- . Should ( )
73
- . Contain ( "--helpOutputFormat" ) ;
70
+ . ShouldContain ( "--helpOutputFormat" ) ;
74
71
}
75
72
76
73
[ Test ]
77
74
public async Task ShouldReturnOptionSuggestions ( )
78
75
{
79
- await completeCommand . Execute ( new [ ] { "--helpOut" } ) ;
76
+ await completeCommand . Execute ( [ "--helpOut" ] ) ;
77
+
80
78
output . ToString ( )
81
- . Should ( )
82
- . Contain ( "--helpOutputFormat" )
83
- . And . NotContain ( "--help\n " ) ;
79
+ . ShouldSatisfyAllConditions (
80
+ actual => actual . ShouldContain ( "--helpOutputFormat" ) ,
81
+ actual => actual . ShouldNotContain ( "--help\n " )
82
+ ) ;
84
83
}
85
84
86
85
[ Test ]
87
86
public async Task ShouldReturnAllSubCommandsWhenEmptyArguments ( )
88
87
{
89
- await completeCommand . Execute ( new [ ] { "" } ) ;
88
+ await completeCommand . Execute ( [ "" ] ) ;
90
89
output . ToString ( )
91
- . Should ( )
92
- . Contain ( "help" )
93
- . And . Contain ( "test" ) ;
90
+ . ShouldSatisfyAllConditions (
91
+ actual => actual . ShouldContain ( "help" ) ,
92
+ actual => actual . ShouldContain ( "test" )
93
+ ) ;
94
94
}
95
95
96
96
[ Test ]
97
97
public async Task ShouldStopSubCommandCompletionAfterOptionSuggestion ( )
98
98
{
99
- await completeCommand . Execute ( new [ ] { "test" , "--api" , "API-KEY" , "--u" } ) ;
99
+ await completeCommand . Execute ( [ "test" , "--api" , "API-KEY" , "--u" ] ) ;
100
100
output . ToString ( )
101
- . Should ( )
102
- . Contain ( "--url" ) ;
101
+ . ShouldContain ( "--url" ) ;
103
102
}
104
103
105
104
[ Test ]
@@ -109,8 +108,7 @@ public async Task SupportsHelpOption(string commandLine)
109
108
{
110
109
await completeCommand . Execute ( commandLine . Split ( ' ' ) ) ;
111
110
output . ToString ( )
112
- . Should ( )
113
- . Contain ( "Where <command> is the current command line to filter auto-completions" ) ;
111
+ . ShouldContain ( "Where <command> is the current command line to filter auto-completions" ) ;
114
112
}
115
113
116
114
[ TearDown ]
0 commit comments