@@ -8,19 +8,35 @@ public sealed class CommandAppTester
8
8
private Action < CommandApp > ? _appConfiguration ;
9
9
private Action < IConfigurator > ? _configuration ;
10
10
11
+ /// <summary>
12
+ /// Gets or sets the Registrar to use in the CommandApp.
13
+ /// </summary>
14
+ public ITypeRegistrar ? Registrar { get ; set ; }
15
+
16
+ /// <summary>
17
+ /// Gets or sets the settings for the <see cref="CommandAppTester"/>.
18
+ /// </summary>
19
+ public CommandAppTesterSettings TestSettings { get ; set ; }
20
+
11
21
/// <summary>
12
22
/// Initializes a new instance of the <see cref="CommandAppTester"/> class.
13
23
/// </summary>
14
24
/// <param name="registrar">The registrar.</param>
15
- public CommandAppTester ( ITypeRegistrar ? registrar = null )
25
+ /// <param name="settings">The settings.</param>
26
+ public CommandAppTester ( ITypeRegistrar ? registrar = null , CommandAppTesterSettings ? settings = null )
16
27
{
17
28
Registrar = registrar ;
29
+ TestSettings = settings ?? new CommandAppTesterSettings ( ) ;
18
30
}
19
31
20
32
/// <summary>
21
- /// Gets or sets the Registrar to use in the CommandApp .
33
+ /// Initializes a new instance of the <see cref="CommandAppTester"/> class .
22
34
/// </summary>
23
- public ITypeRegistrar ? Registrar { get ; set ; }
35
+ /// <param name="settings">The settings.</param>
36
+ public CommandAppTester ( CommandAppTesterSettings settings )
37
+ {
38
+ TestSettings = settings ;
39
+ }
24
40
25
41
/// <summary>
26
42
/// Sets the default command.
@@ -135,10 +151,8 @@ private CommandAppResult Run(string[] args, TestConsole console, Action<IConfigu
135
151
136
152
var result = app . Run ( args ) ;
137
153
138
- var output = console . Output
139
- . NormalizeLineEndings ( )
140
- . TrimLines ( )
141
- . Trim ( ) ;
154
+ var output = console . Output . NormalizeLineEndings ( ) ;
155
+ output = TestSettings . TrimConsoleOutput ? output . TrimLines ( ) . Trim ( ) : output ;
142
156
143
157
return new CommandAppResult ( result , output , context , settings ) ;
144
158
}
@@ -181,10 +195,8 @@ private async Task<CommandAppResult> RunAsync(string[] args, TestConsole console
181
195
182
196
var result = await app . RunAsync ( args ) ;
183
197
184
- var output = console . Output
185
- . NormalizeLineEndings ( )
186
- . TrimLines ( )
187
- . Trim ( ) ;
198
+ var output = console . Output . NormalizeLineEndings ( ) ;
199
+ output = TestSettings . TrimConsoleOutput ? output . TrimLines ( ) . Trim ( ) : output ;
188
200
189
201
return new CommandAppResult ( result , output , context , settings ) ;
190
202
}
0 commit comments