spectre.console
spectre.console copied to clipboard
It would be usefull to allow using the config or a constructor to pass a test console which could be configured externally
It would be usefull to allow the constructor to pass a test console which could be configured externally, I would like to do integration test with interactive test inputs into console but cant do it externally without having to implement my own CommandAppTester since class is sealed. Perhaps just like with a test register we could pass this onto the constructor or maybe use the config console method could be an alternative.
public CommandAppTester(ITypeRegistrar? registrar = null, TestConsole? console = null)
{
Registrar = registrar;
_console = console ?? new TestConsole().Width(int.MaxValue);
}
Here we coud use the _console https://github.com/spectreconsole/spectre.console/blob/58bf89a56a7f747665acff45484abf9182fd3977/src/Spectre.Console.Testing/Cli/CommandAppTester.cs#L107 https://github.com/spectreconsole/spectre.console/blob/58bf89a56a7f747665acff45484abf9182fd3977/src/Spectre.Console.Testing/Cli/CommandAppTester.cs#L153
Woud be happy to raise a PR (if I'm allowed to)
@scarbon I like this idea, it fits within the general paradigm of our development, it keeps the class sealed, and I see the usefulness of it. Unless another maintainer tells me otherwise in the next few days, I would welcome this as a PR. However, please do note that suitable test coverage is required. Tag me when opened and I can review the PR.
Related to https://github.com/spectreconsole/spectre.console/issues/1737
Let's get this PR motoring @scarbon.
Related to #1737 Yep exactly what I was thinking with changes I was looking for when Iwas doing advent of code
Dang I was totally going to make this PR I was waiting for reply to my issue. #1713
Done. Please review the PR and let me know your thoughts! Thanks https://github.com/spectreconsole/spectre.console/pull/1803
Should this issue still be open, now that #1803 has been merged?
Yes. Thanks for telling