Beispiel #1
0
        public void SaveFileFromRepositoryTest()
        {
            GitRepository.Init(tempFolder);
            File.WriteAllLines(tempFilePath, lines);

            GitRepository tracker = new GitRepository(tempFolder);
            tracker.StageFile(tempFile);
            tracker.Commit("test");

            var tmp = Path.Combine(Path.GetTempPath(), tempFile) + ".bk";
            tracker.SaveFileFromLastCommit(tempFile, tmp);
            var newlines = File.ReadAllLines(tmp);
            Assert.AreEqual(lines[0], newlines[0]);
            Assert.AreEqual(lines[1], newlines[1]);
            Assert.AreEqual(lines[2], newlines[2]);
        }