mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 21:38:16 +08:00
Added a TypeRegistrar to CommandAppTester
exposed as a public property. For convenience, and to keep the similarity to the real CommandApp it is also available in the ctor of CommandAppTester.
This commit is contained in:

committed by
Patrik Svensson

parent
b92827ce3d
commit
6b5b31957c
@ -11,6 +11,20 @@ namespace Spectre.Console.Testing
|
||||
private Action<CommandApp>? _appConfiguration;
|
||||
private Action<IConfigurator>? _configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CommandAppTester"/> class.
|
||||
/// </summary>
|
||||
/// <param name="registrar">The registrar.</param>
|
||||
public CommandAppTester(ITypeRegistrar? registrar = null)
|
||||
{
|
||||
Registrar = registrar;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Registrar to use in the CommandApp.
|
||||
/// </summary>
|
||||
public ITypeRegistrar? Registrar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the default command.
|
||||
/// </summary>
|
||||
@ -88,7 +102,7 @@ namespace Spectre.Console.Testing
|
||||
CommandContext? context = null;
|
||||
CommandSettings? settings = null;
|
||||
|
||||
var app = new CommandApp();
|
||||
var app = new CommandApp(Registrar);
|
||||
_appConfiguration?.Invoke(app);
|
||||
|
||||
if (_configuration != null)
|
||||
|
Reference in New Issue
Block a user