public void GetLastParentTfsCommits_WhenThereIsMoreThanTfsChangeset_ThenReturnTheLast() { h.SetupFake(r => { r.Changeset(42, "UseLess! Just to have the same changeset Id that the commit already in repo (and fetch nothing)", DateTime.Parse("2012-01-01 12:12:12 -05:00")) .Change(TfsChangeType.Add, TfsItemType.Folder, "$/MyProject"); }); string c1 = null; string c2 = null; string c3 = null; h.SetupGitRepo("repo", g => { c1 = g.Commit("A sample commit from TFS.\n\ngit-tfs-id: [http://server/tfs]$/MyProject/trunk;C1"); c2 = g.Commit("A sample commit from TFS.\n\ngit-tfs-id: [http://server/tfs]$/MyProject/trunk;C2"); c3 = g.Commit("A sample commit from TFS.\n\ngit-tfs-id: [http://server/tfs]$/MyProject/trunk;C3"); }); using (var repo = h.Repository("repo")) { var gitRepository = new GitRepository(repo.Info.WorkingDirectory, new Container(), null, new RemoteConfigConverter()); var changesets = gitRepository.GetLastParentTfsCommits("HEAD"); Assert.Single(changesets); Assert.Equal(c3, changesets.First().GitCommit); } }
public void WhenNoValueIsSet_ThenDefaultValueIsReturned() { h.SetupGitRepo("repo", g => { g.Commit("A sample commit from TFS.\n\ngit-tfs-id: [http://server/tfs]$/MyProject/trunk;C1"); }); using (var repo = h.Repository("repo")) { var gitRepository = new GitRepository(repo.Info.WorkingDirectory, new Container(), null, new RemoteConfigConverter()); var configProperties = new ConfigProperties(new ConfigPropertyLoader(new Globals() { Repository = gitRepository })); Assert.Equal(100, configProperties.BatchSize); } }
public void GetCommit_WhenNoCommitIsFound_ThenReturnsNull() { h.SetupGitRepo("repo", g => { }); using (var repo = h.Repository("repo")) { var gitRepository = new GitRepository(repo.Info.WorkingDirectory, new Container(), null, new RemoteConfigConverter()); Assert.Null(gitRepository.GetCommit("b1accc619681b0348aaec303f0fce6f463890c74")); } }
public void BootstrapWithNoRemotes() { h.SetupGitRepo("repo", g => { g.Commit("A sample commit."); }); h.RunIn("repo", "bootstrap"); h.AssertNoRef("repo", "tfs/default"); }