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

Added a TypeRegistrar to CommandAppTester #462

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

nils-a
Copy link
Contributor

@nils-a nils-a commented Jun 21, 2021

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 is in regard to #461

I'm not quite fond of the used-in-this-one-place implementation of FakeRegistrar, but I see no real good alternative except exposing the DefaultRegistrar to be used in tests or creating a second (fully implemented) ITypeRegistrar for tests.

@CLAassistant
Copy link

CLAassistant commented Jun 21, 2021

CLA assistant check
All committers have signed the CLA.

@patriksvensson
Copy link
Contributor

@nils-a I just pushed a fix for the analyzer where we moved the test project to the root. Sorry, didn't think about your PR when I did that so you will have to rebase your branch and fix the merge conflict 😢

I think the fake registrar is OK but perhaps we could re-use the FakeTypeRegistrar for this purpose?

@nils-a
Copy link
Contributor Author

nils-a commented Jun 23, 2021

@patriksvensson

so you will have to rebase your branch and fix the merge conflict

Not a problem. 👍

perhaps we could re-use the FakeTypeRegistrar for this purpose?

I've thought about that. (In fact I implemented it, then reverted..) The problem I see with that approach is that FakeTypeRegistrar currently returns null on Build(). Implementing an ITypeResolver would be a breaking change in Spectre.Console.Testing.

But... Thinking about it now... I could add the ITypeResolver as optional feature. Have the result of the Build method injectable per Func.

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.
Copy link
Contributor

@patriksvensson patriksvensson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@patriksvensson patriksvensson merged commit 6b5b319 into spectreconsole:main Jun 23, 2021
@nils-a nils-a deleted the nils-a-461 branch June 24, 2021 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants