@@ -14,6 +14,12 @@ public class BranchCollection : IEnumerable<Branch>
14
14
{
15
15
private readonly Repository repo ;
16
16
17
+ /// <summary>
18
+ /// Needed for mocking purposes.
19
+ /// </summary>
20
+ protected BranchCollection ( )
21
+ { }
22
+
17
23
/// <summary>
18
24
/// Initializes a new instance of the <see cref = "BranchCollection" /> class.
19
25
/// </summary>
@@ -26,7 +32,7 @@ internal BranchCollection(Repository repo)
26
32
/// <summary>
27
33
/// Gets the <see cref = "LibGit2Sharp.Branch" /> with the specified name.
28
34
/// </summary>
29
- public Branch this [ string name ]
35
+ public virtual Branch this [ string name ]
30
36
{
31
37
get
32
38
{
@@ -69,7 +75,7 @@ private Branch BuildFromReferenceName(string canonicalName)
69
75
/// Returns an enumerator that iterates through the collection.
70
76
/// </summary>
71
77
/// <returns>An <see cref = "IEnumerator{T}" /> object that can be used to iterate through the collection.</returns>
72
- public IEnumerator < Branch > GetEnumerator ( )
78
+ public virtual IEnumerator < Branch > GetEnumerator ( )
73
79
{
74
80
return Libgit2UnsafeHelper
75
81
. ListAllBranchNames ( repo . Handle , GitBranchType . GIT_BRANCH_LOCAL | GitBranchType . GIT_BRANCH_REMOTE )
@@ -95,7 +101,7 @@ IEnumerator IEnumerable.GetEnumerator()
95
101
/// <param name = "shaOrReferenceName">The target which can be sha or a canonical reference name.</param>
96
102
/// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
97
103
/// <returns></returns>
98
- public Branch Add ( string name , string shaOrReferenceName , bool allowOverwrite = false )
104
+ public virtual Branch Add ( string name , string shaOrReferenceName , bool allowOverwrite = false )
99
105
{
100
106
Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
101
107
@@ -128,7 +134,7 @@ public Branch Create(string name, string shaOrReferenceName, bool allowOverwrite
128
134
/// </summary>
129
135
/// <param name = "name">The name of the branch to delete.</param>
130
136
/// <param name = "isRemote">True if the provided <paramref name="name"/> is the name of a remote branch, false otherwise.</param>
131
- public void Remove ( string name , bool isRemote = false )
137
+ public virtual void Remove ( string name , bool isRemote = false )
132
138
{
133
139
Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
134
140
@@ -160,7 +166,7 @@ public void Delete(string name, bool isRemote = false)
160
166
///<param name = "newName">The new name of the existing branch should bear.</param>
161
167
///<param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
162
168
///<returns></returns>
163
- public Branch Move ( string currentName , string newName , bool allowOverwrite = false )
169
+ public virtual Branch Move ( string currentName , string newName , bool allowOverwrite = false )
164
170
{
165
171
Ensure . ArgumentNotNullOrEmptyString ( currentName , "currentName" ) ;
166
172
Ensure . ArgumentNotNullOrEmptyString ( newName , "name" ) ;
0 commit comments