-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add repository model tests #97
Conversation
Testing RepositoryModel creation via the path constructor implies hitting libgit2sharp codepaths, and libgit2sharp doesn't expose nice interfaces for testing (why??). So, move things around and add a GitService that replaces the extension methods that depend on libgit2sharp, so we can at least mock at a higher level. The things that require this GitService are not created via mef, so expose it via the Services static class.
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.
This got moved up to VSExtensions 'cause it makes sense there.
The prior code always created a `IGitService` instance, but we only need to create them if there are any active repositories. Also changed to use `.Any()` because it is more expressive.
Also we should prefer to use `var` unless the type's really not clear at all from the right hand side. Also, I prefer all the usings on top and not within namespaces.
I documented all the methods.
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.
@shana: So according to R#, there is no type in the solution that inherits from both EnvDTE.DTE
and EnvDTE80.DTE2
. That leads me to believe that the Dte2
property is always null. Also, I can't find any usages of the Dte2
property. Do we need this?
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.
🍍 |
@shana: If you're ok with my changes, this is good to merge. The only outstanding question is the |
@haacked Changes look 👍! |
✨ |
This PR is based on #79, so that one should be merged first before looking at this.
Add repository model tests and support for testing things that rely on the GetUri and GetRepo extension methods that use libgit2#.
Testing RepositoryModel creation via the path constructor implies hitting libgit2sharp codepaths, and libgit2sharp doesn't expose nice interfaces for testing (why??). So, move things around and add a
GitService that replaces the extension methods that depend on libgit2sharp, so we can at least mock at a higher level.
The things that require this GitService are not created via mef, so expose it via the Services static class.