Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-05-13 11:42:12 +0400
committernulltoken <emeric.fermas@gmail.com>2012-05-20 14:56:24 +0400
commit9c18c1987fab42ba50e72f496111666ff61cf60f (patch)
treeb82332af5070d3768f792a6b0b41dd1bcf1487f6 /LibGit2Sharp.Tests/BranchFixture.cs
parent69207a6bb357cc2e801361bcbeffda5803cfa330 (diff)
Delegate the to deletion of branches to libgit2 native method
Diffstat (limited to 'LibGit2Sharp.Tests/BranchFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/BranchFixture.cs35
1 files changed, 34 insertions, 1 deletions
diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs
index 81edf209..5e29d740 100644
--- a/LibGit2Sharp.Tests/BranchFixture.cs
+++ b/LibGit2Sharp.Tests/BranchFixture.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Linq;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
@@ -430,6 +429,40 @@ namespace LibGit2Sharp.Tests
}
}
+ private void AssertDeletion(string branchName, bool isRemote, bool shouldPrevisoulyAssertExistence)
+ {
+ TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoPath);
+
+ using (var repo = new Repository(path.RepositoryPath))
+ {
+ if (shouldPrevisoulyAssertExistence)
+ {
+ Assert.NotNull(repo.Branches[branchName]);
+ }
+
+ repo.Branches.Delete(branchName, isRemote);
+ Branch branch = repo.Branches[branchName];
+ Assert.Null(branch);
+ }
+ }
+
+ [Theory]
+ [InlineData("i-do-numbers", false)]
+ [InlineData("origin/br2", true)]
+ public void CanDeleteAnExistingBranch(string branchName, bool isRemote)
+ {
+ AssertDeletion(branchName, isRemote, true);
+ }
+
+
+ [Theory]
+ [InlineData("I-donot-exist", false)]
+ [InlineData("me/neither", true)]
+ public void CanDeleteANonExistingBranch(string branchName, bool isRemote)
+ {
+ AssertDeletion(branchName, isRemote, false);
+ }
+
[Fact]
public void DeletingABranchWhichIsTheCurrentHeadThrows()
{