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

CleanFixture.cs « LibGit2Sharp.Tests - github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f674285c6121d54564195bbbcc90eb94ba593ddc (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
using System.Linq;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;

namespace LibGit2Sharp.Tests
{
    public class CleanFixture : BaseFixture
    {
        [Fact]
        public void CanCleanWorkingDirectory()
        {
            string path = SandboxStandardTestRepo();
            using (var repo = new Repository(path))
            {
                // Verify that there are the expected number of entries and untracked files
                Assert.Equal(6, repo.RetrieveStatus().Count());
                Assert.Equal(1, repo.RetrieveStatus().Untracked.Count());

                repo.RemoveUntrackedFiles();

                // Verify that there are the expected number of entries and 0 untracked files
                Assert.Equal(5, repo.RetrieveStatus().Count());
                Assert.Equal(0, repo.RetrieveStatus().Untracked.Count());
            }
        }

        [Fact]
        public void CannotCleanABareRepository()
        {
            string path = SandboxBareTestRepo();
            using (var repo = new Repository(path))
            {
                Assert.Throws<BareRepositoryException>(() => repo.RemoveUntrackedFiles());
            }
        }
    }
}