-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add mediator classes #211
Add mediator classes #211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors the mediator-related functionality to improve code maintainability by introducing dependency injection for mediator classes in various components, and updates related tests accordingly.
- Introduced and injected SavedSearchesMediator and AuthenticationMediator instances to replace static event handling.
- Updated constructor signatures and mediator event subscriptions across forms, commands, and tests.
- Minor cleanups in GlobalSuppressions and dependency adjustments in Program.cs.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
GitHubExtension/Program.cs | Injects mediator instances into page factories and command providers and manages disposables. |
GitHubExtension/GlobalSuppressions.cs | Removes an obsolete suppression, reducing noise. |
GitHubExtension/GitHubExtensionCommandsProvider.cs | Replaces static event hooks with mediator-based event subscriptions. |
GitHubExtension/GitHubExtension.cs | Updates Dispose behavior to use the Release event. |
GitHubExtension/Controls/SavedSearchesMediator.cs | Adds a new mediator class for saved search events. |
GitHubExtension/Controls/Pages/SearchPages/SearchPageFactory.cs | Passes mediator instance into SaveSearchForm creation. |
GitHubExtension/Controls/Pages/SavedSearchesPage.cs | Updates mediator event subscriptions and changes refresh behavior on removal. |
GitHubExtension/Controls/Forms/SignInForm.cs & SignOutForm.cs | Updates forms to use the AuthenticationMediator instead of static events. |
GitHubExtension/Controls/Forms/SaveSearchForm.cs | Updates constructor signatures to include mediator dependency. |
GitHubExtension/Controls/Commands/RemoveSavedSearchCommand.cs | Uses mediator calls when removing a saved search instead of raising static events. |
GitHubExtension/Controls/AuthenticationMediator.cs | Adds a new mediator class for authentication events. |
GitHubExtension.Test | Updates tests to supply mediator instances into SaveSearchForm and SavedSearchesPage constructors. |
Comments suppressed due to low confidence (1)
GitHubExtension/Controls/Pages/SavedSearchesPage.cs:63
- Replacing the call to RaiseItemsChanged with a hardcoded 0 may clear the UI even when not all saved searches have been removed. Consider reloading the count from the repository to accurately reflect the remaining items.
RaiseItemsChanged(0);
This pull request focuses on refactoring the
GitHubQueryValidationTests
andSaveSearchFormTest
classes to improve code maintainability and readability by introducing a helper method for creatingSaveSearchForm
instances and adding aSavedSearchesMediator
parameter to theSaveSearchForm
constructor.Refactoring for code maintainability:
GitHubExtension.Test/Controls/GitHubQueryValidationTests.cs
: Introduced theCreateSaveSearchForm
method to streamline the creation ofSaveSearchForm
instances across multiple test methods. This change reduces code duplication and enhances readability. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]GitHubExtension.Test/Controls/SaveSearchFormTest.cs
: Updated theSaveSearchForm
constructor calls to include theSavedSearchesMediator
parameter, ensuring consistency and completeness in the test setup. This change affects multiple test methods, ensuring they are properly initialized with the new dependency. [1] [2] [3] [4] [5] [6] [7]