@@ -8,19 +8,35 @@ public sealed class CommandAppTester
88 private Action < CommandApp > ? _appConfiguration ;
99 private Action < IConfigurator > ? _configuration ;
1010
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+
1121 /// <summary>
1222 /// Initializes a new instance of the <see cref="CommandAppTester"/> class.
1323 /// </summary>
1424 /// <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 )
1627 {
1728 Registrar = registrar ;
29+ TestSettings = settings ?? new CommandAppTesterSettings ( ) ;
1830 }
1931
2032 /// <summary>
21- /// Gets or sets the Registrar to use in the CommandApp .
33+ /// Initializes a new instance of the <see cref="CommandAppTester"/> class .
2234 /// </summary>
23- public ITypeRegistrar ? Registrar { get ; set ; }
35+ /// <param name="settings">The settings.</param>
36+ public CommandAppTester ( CommandAppTesterSettings settings )
37+ {
38+ TestSettings = settings ;
39+ }
2440
2541 /// <summary>
2642 /// Sets the default command.
@@ -135,10 +151,8 @@ private CommandAppResult Run(string[] args, TestConsole console, Action<IConfigu
135151
136152 var result = app . Run ( args ) ;
137153
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 ;
142156
143157 return new CommandAppResult ( result , output , context , settings ) ;
144158 }
@@ -181,10 +195,8 @@ private async Task<CommandAppResult> RunAsync(string[] args, TestConsole console
181195
182196 var result = await app . RunAsync ( args ) ;
183197
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 ;
188200
189201 return new CommandAppResult ( result , output , context , settings ) ;
190202 }
0 commit comments