コード例 #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.Single(changesets);
                Assert.Equal(c3, changesets.First().GitCommit);
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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"));
            }
        }
コード例 #4
0
ファイル: BootstrapTests.cs プロジェクト: SQureshi33/Demo
 public void BootstrapWithNoRemotes()
 {
     h.SetupGitRepo("repo", g =>
     {
         g.Commit("A sample commit.");
     });
     h.RunIn("repo", "bootstrap");
     h.AssertNoRef("repo", "tfs/default");
 }