Ejemplo n.º 1
0
        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.Equal(1, changesets.Count());
                Assert.Equal(c3, changesets.First().GitCommit);
            }
        }
Ejemplo n.º 2
0
 public void BootstrapWithNoRemotes()
 {
     h.SetupGitRepo("repo", g =>
     {
         g.Commit("A sample commit.");
     });
     h.RunIn("repo", "bootstrap");
     h.AssertNoRef("repo", "tfs/default");
 }
        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);
            }
        }