diff options
author | yorah <yoram.harmelin@gmail.com> | 2012-06-14 20:07:01 +0400 |
---|---|---|
committer | yorah <yoram.harmelin@gmail.com> | 2012-06-18 01:31:10 +0400 |
commit | a9d6e0cd64fb97ed126b5b905134a83476fa2132 (patch) | |
tree | cec64b96d18aad26232650c97aa7ff882504098d /LibGit2Sharp/BranchCollection.cs | |
parent | 82a68d110dfb1f2f31f555a7f9accbd6705422cb (diff) |
Make BranchCollection mockable
Diffstat (limited to 'LibGit2Sharp/BranchCollection.cs')
-rw-r--r-- | LibGit2Sharp/BranchCollection.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/LibGit2Sharp/BranchCollection.cs b/LibGit2Sharp/BranchCollection.cs index c5dc851f..148bda28 100644 --- a/LibGit2Sharp/BranchCollection.cs +++ b/LibGit2Sharp/BranchCollection.cs @@ -15,6 +15,12 @@ namespace LibGit2Sharp private readonly Repository repo; /// <summary> + /// Needed for mocking purposes. + /// </summary> + protected BranchCollection() + { } + + /// <summary> /// Initializes a new instance of the <see cref = "BranchCollection" /> class. /// </summary> /// <param name = "repo">The repo.</param> @@ -26,7 +32,7 @@ namespace LibGit2Sharp /// <summary> /// Gets the <see cref = "LibGit2Sharp.Branch" /> with the specified name. /// </summary> - public Branch this[string name] + public virtual Branch this[string name] { get { @@ -69,7 +75,7 @@ namespace LibGit2Sharp /// Returns an enumerator that iterates through the collection. /// </summary> /// <returns>An <see cref = "IEnumerator{T}" /> object that can be used to iterate through the collection.</returns> - public IEnumerator<Branch> GetEnumerator() + public virtual IEnumerator<Branch> GetEnumerator() { return Libgit2UnsafeHelper .ListAllBranchNames(repo.Handle, GitBranchType.GIT_BRANCH_LOCAL | GitBranchType.GIT_BRANCH_REMOTE) @@ -95,7 +101,7 @@ namespace LibGit2Sharp /// <param name = "shaOrReferenceName">The target which can be sha or a canonical reference name.</param> /// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param> /// <returns></returns> - public Branch Add(string name, string shaOrReferenceName, bool allowOverwrite = false) + public virtual Branch Add(string name, string shaOrReferenceName, bool allowOverwrite = false) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -128,7 +134,7 @@ namespace LibGit2Sharp /// </summary> /// <param name = "name">The name of the branch to delete.</param> /// <param name = "isRemote">True if the provided <paramref name="name"/> is the name of a remote branch, false otherwise.</param> - public void Remove(string name, bool isRemote = false) + public virtual void Remove(string name, bool isRemote = false) { Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -160,7 +166,7 @@ namespace LibGit2Sharp ///<param name = "newName">The new name of the existing branch should bear.</param> ///<param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param> ///<returns></returns> - public Branch Move(string currentName, string newName, bool allowOverwrite = false) + public virtual Branch Move(string currentName, string newName, bool allowOverwrite = false) { Ensure.ArgumentNotNullOrEmptyString(currentName, "currentName"); Ensure.ArgumentNotNullOrEmptyString(newName, "name"); |