Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It would be usefull to allow using the config or a constructor to pass a test console which could be configured externally #1718

Open
scarbon opened this issue Dec 22, 2024 · 4 comments
Labels
area-Testing-Framework Spectre.Console testing framework for developers. feature

Comments

@scarbon
Copy link

scarbon commented Dec 22, 2024

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

var console = new TestConsole().Width(int.MaxValue);

var console = new TestConsole().Width(int.MaxValue);

Woud be happy to raise a PR (if I'm allowed to)

@github-project-automation github-project-automation bot moved this to Todo 🕑 in Spectre Console Dec 22, 2024
@FrankRay78 FrankRay78 added area-Testing-Framework Spectre.Console testing framework for developers. feature labels Jan 14, 2025
@FrankRay78
Copy link
Contributor

@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.

@FrankRay78
Copy link
Contributor

Related to #1737

@FrankRay78
Copy link
Contributor

Let's get this PR motoring @scarbon.

@byte2pixel
Copy link

byte2pixel commented Jan 27, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Testing-Framework Spectre.Console testing framework for developers. feature
Projects
Status: Todo 🕑
Development

No branches or pull requests

3 participants