microsoft / microsoft/VFSForGit

Make GVFSService.Windows & GVFSService.Mac follow similar implementation pattern

Open
#1,045 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

platform: macOS pr: refactoring
Dominant language
C#
Stars
6.1k
Forks
474
Avg merge
2d 4h
Merged PRs (30d)
8

Description

Reference -

In GVFSService.Windows.cs this.repoRegistry and this.requestHandler are created in Run rather than the constructor. Can we do the same here and create these in RunWithArgs?

Unless there is a reason this has to be in the constructor I think we'd be better off keeping the classes consistent across platforms.

@alameenshah
alameenshah 4 hours ago Author Member
Initializing these in the Constructor makes it easy for UT. Dependencies (repoRegistry, requestHandler) can be Mocked and the Mock objects can be injected as arguments to the Constructor. This is the pattern I use in the upcoming UT PR. We can probably use this pattern in GVFSService.Windows.cs if we decide to do UT for that class.

@wilbaker
wilbaker 7 minutes ago Member
We can probably use this pattern in GVFSService.Windows.cs if we decide to do UT for that class.
Even if we're not writing UT for Windows in the near future, can we still make the code structure on Mac and Windows consistent?

@wilbaker
wilbaker 6 minutes ago Member
If you add a TODO to your PR/Work Item for your UT work I am okay with deferring the change until then, I just don't want us to lose track of it 😄

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare GVFSService.Windows.cs and GVFSService.Mac.cs, starting with how dependencies are created in Run and RunWithArgs. Confirm whether moving the Mac initialization is still the intended consistency change, and check the related upcoming unit-test work or TODO before considering it done.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.