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

Simplify IoC for LangServer tests #8644

Merged
merged 4 commits into from
Oct 11, 2022
Merged

Simplify IoC for LangServer tests #8644

merged 4 commits into from
Oct 11, 2022

Conversation

anthony-c-martin
Copy link
Member

@anthony-c-martin anthony-c-martin commented Oct 10, 2022

This uses a similar setup to #8570 for injecting langauge server dependencies in integration tests.

Microsoft Reviewers: Open in CodeFlow

Copy link
Contributor

@jeskew jeskew left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but had a question about the expected behavior when AddSingleton<X, Y>() and AddSingleton<X, Z>() are both called on the same container.

Comment on lines +26 to +28
public record IOContext(
TextWriter Output,
TextWriter Error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this simplification!

=> new Program(new(Output: @out, Error: err), services
=> services
.WithEmptyAzResources()
.WithFeatureOverrides(settings.FeatureOverrides)
Copy link
Contributor

Choose a reason for hiding this comment

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

How does the DI container handle multiple singletons for an interface? Does the registration for IFeatureProviderFactory performed in this method take precedence over the one performed in services.AddBicepCore() because WithFeatureOverrides is invoked first?

Copy link
Member Author

Choose a reason for hiding this comment

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

The last registration wins - this callback is executed after services.AddBicepCore()

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

2 participants