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

CurrentOperationFixture.cs « LibGit2Sharp.Tests - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8944bbeb44ebc96068017c9a088979284e7d7b1d (plain)
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);
            }
        }
    }
}