forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrentOperationFixture.cs
55 lines (49 loc) · 1.9 KB
/
CurrentOperationFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.IO;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;
namespace LibGit2Sharp.Tests
{
public class CurrentOperationFixture : BaseFixture
{
[Theory]
[InlineData(true)]
[InlineData(false)]
public void CurrentOperationIsNoneForNewRepo(bool isBare)
{
string repoPath = InitNewRepository(isBare);
using (var repo = new Repository(repoPath))
{
Assert.Equal(CurrentOperation.None, repo.Info.CurrentOperation);
}
}
[Fact]
public void CurrentOperationInNoneForABareRepo()
{
string path = SandboxBareTestRepo();
using (var repo = new Repository(path))
{
Assert.Equal(CurrentOperation.None, repo.Info.CurrentOperation);
}
}
[Theory]
[InlineData("MERGE_HEAD", CurrentOperation.Merge)]
[InlineData("REVERT_HEAD", CurrentOperation.Revert)]
[InlineData("CHERRY_PICK_HEAD", CurrentOperation.CherryPick)]
[InlineData("BISECT_LOG", CurrentOperation.Bisect)]
[InlineData("rebase-apply/rebasing", CurrentOperation.Rebase)]
[InlineData("rebase-apply/applying", CurrentOperation.ApplyMailbox)]
[InlineData("rebase-apply/whatever", CurrentOperation.ApplyMailboxOrRebase)]
[InlineData("rebase-merge/interactive", CurrentOperation.RebaseInteractive)]
[InlineData("rebase-merge/whatever", CurrentOperation.RebaseMerge)]
public void CurrentOperationHasExpectedPendingOperationValues(string stateFile, CurrentOperation expectedState)
{
string path = SandboxStandardTestRepo();
Touch(Path.Combine(path, ".git"), stateFile);
using (var repo = new Repository(path))
{
Assert.Equal(expectedState, repo.Info.CurrentOperation);
}
}
}
}