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

feat(HostBuilderExtensions): Code deduplication and added/fixed tests #415

Merged
merged 5 commits into from Jan 9, 2021

Conversation

cbcrouse
Copy link
Contributor

@cbcrouse cbcrouse commented Jan 9, 2021

Continuation of Issue 408

There's another PR out there, but I'm continuing this work since they are not able to continue it.

[Fact]
public async Task ItThrowsOnUnknownSubCommand()
{
var ex = await Assert.ThrowsAsync<UnrecognizedCommandParsingException>(
() => new HostBuilder()
.ConfigureServices(collection => collection.AddSingleton<IConsole>(new TestConsole(_output)))
.RunCommandLineApplicationAsync<ParentCommand>(new string[] { "return41" }));
Copy link
Owner

Choose a reason for hiding this comment

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

Why did so many of existing tests change to add app => { } to the RunCommandLineApplicationAsync call?

Copy link
Owner

Choose a reason for hiding this comment

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

I'm going to add a change to this PR to preserve the existing behavior. While not technically a binary breaking change, requiring this extra parameter would probably some users upgrading.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @natemcmaster - Thanks for taking the time to review this PR.

This was because there was code flagged as unreachable that I removed in several of the extension methods. Here's an example.

After reviewing, I am now realizing that this is seemingly a breaking change and I shouldn't have made it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like you've realized this too and already made the necessary changes to fix this behavior. Thanks.

@natemcmaster natemcmaster changed the base branch from main to feature/408 January 9, 2021 22:17
@natemcmaster
Copy link
Owner

Thanks for the contribution, @cbcrouse !

@natemcmaster natemcmaster merged commit 643f9c3 into natemcmaster:feature/408 Jan 9, 2021
@cbcrouse
Copy link
Contributor Author

cbcrouse commented Jan 9, 2021

Of course @natemcmaster, very much looking forward to this change. Thanks @hellfirehd for getting it started!

@hellfirehd
Copy link
Contributor

Thanks for seeing this through! I really appreciate it!

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.

Expand Microsoft.Extensions.Hosting support to allow work to be done prior to Run*Async()
3 participants