Skip to content

Conversation

@kimdiego2098
Copy link
Collaborator

@kimdiego2098 kimdiego2098 commented Aug 3, 2025

Summary by Sourcery

Introduce IWebClientService interface and refactor WebClientService to depend on it, update DI registration and replace concrete service injections with the new interface across components, samples, and tests

Enhancements:

  • Define IWebClientService abstraction and implement it in WebClientService
  • Register WebClientService in DI as IWebClientService
  • Replace direct WebClientService injections with IWebClientService in components and samples

Tests:

  • Update unit tests to resolve IWebClientService instead of the concrete WebClientService

@bb-auto
Copy link

bb-auto bot commented Aug 3, 2025

Thanks for your PR, @kimdiego2098. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@bb-auto bb-auto bot requested a review from ArgoZhang August 3, 2025 02:42
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Aug 3, 2025

Reviewer's Guide

Extracted an interface for WebClientService and refactored registrations and consumers to use the abstraction, with the concrete class updated to implement the new interface.

Class diagram for IWebClientService extraction and usage

classDiagram
    class IWebClientService {
        <<interface>>
        +Task<ClientInfo> GetClientInfo()
        +void SetData(ClientInfo client)
    }
    class WebClientService {
        +Task<ClientInfo> GetClientInfo()
        +void SetData(ClientInfo client)
        +Dispose()
    }
    IWebClientService <|.. WebClientService

    class ClientInfo
    %% Other classes (Online, Client, Dispatches, Locators) now depend on IWebClientService instead of WebClientService
    class Online {
        -IWebClientService? WebClientService
    }
    class Client {
        -IWebClientService? ClientService
    }
    class Dispatches {
        -IWebClientService? ClientService
    }
    class Locators {
        -IWebClientService? ClientService
    }
    Online --> IWebClientService
    Client --> IWebClientService
    Dispatches --> IWebClientService
    Locators --> IWebClientService
Loading

File-Level Changes

Change Details Files
Introduce IWebClientService interface
  • Added new interface file defining GetClientInfo, SetData methods and IAsyncDisposable inheritance
src/BootstrapBlazor/Services/IWebClientService.cs
Implement interface on WebClientService
  • Updated class signature to implement IWebClientService
  • Retained existing logic without functional changes
src/BootstrapBlazor/Services/WebClientService.cs
Register service by interface
  • Changed DI registration to AddScoped<IWebClientService, WebClientService> instead of concrete type
src/BootstrapBlazor/Extensions/BootstrapBlazorServiceCollectionExtensions.cs
Refactor consumers to depend on interface
  • Replaced GetRequiredService() calls with GetRequiredService()
  • Updated [Inject] properties from WebClientService to IWebClientService
test/UnitTest/Services/WebClientServiceTest.cs
test/UnitTest/Services/ConnectionHubTest.cs
src/BootstrapBlazor.Server/Components/Pages/Online.razor.cs
src/BootstrapBlazor.Server/Components/Samples/Client.razor
src/BootstrapBlazor.Server/Components/Samples/Client.razor.cs
src/BootstrapBlazor.Server/Components/Samples/Dispatches.razor.cs
src/BootstrapBlazor.Server/Components/Samples/Locators.razor.cs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @kimdiego2098 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Aug 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (184b491) to head (4665227).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6541   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          714       714           
  Lines        31395     31397    +2     
  Branches      4432      4432           
=========================================
+ Hits         31395     31397    +2     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ArgoZhang ArgoZhang deleted the webclientservice branch August 6, 2025 01:15
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