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

CupboardFixture dependency injection should be open for extension. #37

Open
jetersen opened this issue Nov 4, 2021 · 4 comments
Open

Comments

@jetersen
Copy link
Sponsor Contributor

jetersen commented Nov 4, 2021

At the moment CupboardFixture does not have a way to add more dependencies.

I can of course copy my own cupboard fixture, but would be nice if it was possible to extend.

@jetersen
Copy link
Sponsor Contributor Author

jetersen commented Nov 9, 2021

Seems like I cannot run the cupboard fixture in another project because RunCommands is internal 😓

internal sealed class RunCommand : AsyncCommand<RunCommand.Settings>

Spectre.Console.Cli.CommandRuntimeException: Could not resolve type 'Cupboard.Internal.RunCommand'.

Spectre.Console.Cli.CommandRuntimeException
Could not resolve type 'Cupboard.Internal.RunCommand'.
   at Spectre.Console.Cli.TypeResolverAdapter.Resolve(Type type) in /_/src/Spectre.Console/Cli/Internal/TypeResolverAdapter.cs:line 43
   at Spectre.Console.Cli.CommandTree.CreateCommand(ITypeResolver resolver) in /_/src/Spectre.Console/Cli/Internal/Parsing/CommandTree.cs:line 29
   at Spectre.Console.Cli.CommandExecutor.Execute(CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration configuration) in /_/src/Spectre.Console/Cli/Internal/CommandExecutor.cs:line 107
   at Spectre.Console.Cli.CommandExecutor.Execute(IConfiguration configuration, IEnumerable`1 args) in /_/src/Spectre.Console/Cli/Internal/CommandExecutor.cs:line 84
   at Spectre.Console.Cli.CommandApp.RunAsync(IEnumerable`1 args) in /_/src/Spectre.Console/Cli/CommandApp.cs:line 87
   at Spectre.Console.Cli.CommandApp.Run(IEnumerable`1 args) in /_/src/Spectre.Console/Cli/CommandApp.cs:line 61
   at Spectre.Console.Cli.CommandApp`1.Run(IEnumerable`1 args) in /_/src/Spectre.Console/Cli/CommandAppOfT.cs:line 42
   at Cupboard.CupboardHost.Run(String[] args) in /_/src/Cupboard/CupboardHost.cs:line 32
   at UnitTests.CupboardFixture.Run(String[] args)

@patriksvensson
Copy link
Owner

Not at a computer tonight but will take a look tomorrow.

@patriksvensson
Copy link
Owner

@jetersen Perhaps we could add a ConfigureServices(Action<IServiceProvider>) method to CupboardFixture where custom registrations could be made?

@jetersen
Copy link
Sponsor Contributor Author

@patriksvensson sounds good to me

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

No branches or pull requests

2 participants