public void CanRestoreFile(){ var githelper = new GitHelper{DirectoryName = dirname,AuthorName =Applications.Application.Current.Principal.CurrentUser.Identity.Name}; githelper.Connect(); var initial = githelper.GetCommitId(); var currentFile = githelper.GetContent("x"); Assert.Null(currentFile); githelper.WriteAndCommit("x","a","is a"); var first = githelper.GetCommitId(); Assert.AreNotEqual(initial,first); githelper.WriteAndCommit("x", "b", "is b"); var second = githelper.GetCommitId(); Assert.AreNotEqual(initial, second); var content = githelper.ReadFile("x"); Assert.AreEqual("b",content); githelper.RestoreSingleFile("x",first); content = githelper.ReadFile("x"); Assert.AreEqual("a",content); }
public void CanGetFileListUnicode() { var githelper = new GitHelper { DirectoryName = dirname, AuthorName = Applications.Application.Current.Principal.CurrentUser.Identity.Name }; githelper.Connect(); var initial = githelper.GetCommitId(); var initialList = githelper.GetFileList(); Assert.False(initialList.Any(_ => _ == "абв")); githelper.WriteAndCommit("абв", "a", "is a"); var first = githelper.GetCommitId(); Assert.True(githelper.GetFileList().Any(_ => _ == "абв")); Assert.AreEqual("a", githelper.GetContent("абв")); }
public void CanGetContent() { var githelper = new GitHelper { DirectoryName = dirname, RemoteUrl = "g:/repos/qorpent.kernel" }; githelper.Connect(); var content = githelper.GetContent("LICENSE"); StringAssert.StartsWith("Copyright 2007-2014",content); content = githelper.GetContent("LICENSE", "fd4f64e"); StringAssert.StartsWith("Copyright 2007-2012", content); }