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

SLVS-1491 Refactor: use ConnectedModeManager #5730

Conversation

gabriela-trutan-sonarsource
Copy link
Contributor

@gabriela-trutan-sonarsource gabriela-trutan-sonarsource commented Oct 7, 2024

Refactoring: use ConnectedModeManager in the other places where we instantiate the ManageBindingDialog to make code better testable

…log.

This has multiple advantages including better testability of code and the fact that the callers don't have to add references to all the services required to show the ManageBinding dialog,
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod bot changed the title SLVS-1491 Use ConnectedModeManager SLVS-1491 Use ConnectedModeManager Oct 7, 2024
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource changed the title SLVS-1491 Use ConnectedModeManager SLVS-1491 Refactor: use ConnectedModeManager Oct 7, 2024
suggestSharedBindingGoldBar.When(x => x.Show(ServerType.SonarQube, Arg.Any<Action>())).Do(callInfo =>
{
callInfo.Arg<Action>()();
connectedModeManager.Received(1).ShowManageBindingDialog(true);

Choose a reason for hiding this comment

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

Not sure if it's a good idea to put assertions inside setup code. If you wanted to assert the order of calls, you can use Received.InOrder(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to test the order, but I want to know what happens when the action is called. So, I really have to store the action and call it. I can refactor this to make it more explicit.

Base automatically changed from gt/validate-fix-suggestion to feature/fix-suggestion October 7, 2024 13:49
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource marked this pull request as ready for review October 7, 2024 14:06
Copy link

sonarqubecloud bot commented Oct 7, 2024

@gabriela-trutan-sonarsource gabriela-trutan-sonarsource merged commit 34b0d8a into feature/fix-suggestion Oct 7, 2024
2 checks passed
@gabriela-trutan-sonarsource gabriela-trutan-sonarsource deleted the gt/connected-mode-manager-usage branch October 7, 2024 14:19
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.

2 participants