예제 #1
0
        public void StatusReportsDeletedFile()
        {
            var testPath = CloneTestRepository(_fixture.PopulatedRepositoryPath);
            var testFile = Path.Combine(testPath, "test.txt");

            File.Delete(testFile);
            var wrapper = new Git.GitWrapper(testPath);

            Assert.True(wrapper.AddAll().Result.Success);
            var statusResult = wrapper.Status().Result;

            Assert.True(statusResult.Success);
            Assert.Single(statusResult.DeletedFiles);
            Assert.Equal("test.txt", statusResult.DeletedFiles[0]);
        }
예제 #2
0
        public void StatusReportsNewFile()
        {
            var testPath = CloneTestRepository(_fixture.PopulatedRepositoryPath);
            var testFile = Path.Combine(testPath, "new.txt");

            File.WriteAllLines(testFile, new [] { "Hello", "World" });
            var wrapper = new Git.GitWrapper(testPath);

            Assert.True(wrapper.AddAll().Result.Success);
            var statusResult = wrapper.Status().Result;

            Assert.True(statusResult.Success);
            Assert.Single(statusResult.NewFiles);
            Assert.Equal("new.txt", statusResult.NewFiles[0]);
        }
예제 #3
0
        public void StatusReportsModifiedFile()
        {
            var testPath = CloneTestRepository(_fixture.PopulatedRepositoryPath);
            var testFile = Path.Combine(testPath, "test.txt");
            var lines    = File.ReadAllLines(testFile).ToList();

            lines.RemoveAt(1);
            File.WriteAllLines(testFile, lines);
            var wrapper = new Git.GitWrapper(testPath);

            Assert.True(wrapper.AddAll().Result.Success);
            var statusResult = wrapper.Status().Result;

            Assert.True(statusResult.Success);
            Assert.Single(statusResult.ModifiedFiles);
            Assert.Equal("test.txt", statusResult.ModifiedFiles[0]);
        }