Example #1
0
        public void ShouldReturnSingleRecentCommitWithLocalRefs()
        {
            using (var tempFolder = new TemporaryFolder())
            {
                var tempRepository = new TemporaryRepository(tempFolder);
                tempRepository.RunCommand("init");
                tempRepository.TouchFileAndCommit();

                var executor = new GitCommandExecutor(tempFolder.Path);
                var log      = new LogRetriever(executor).GetRecentCommits().ToArray();

                var commit = log.Single();
                CollectionAssert.AreEqual(new[] { "HEAD", "master" }, commit.Refs);
            }
        }
Example #2
0
        public void ShouldReturnSingleRecentCommitWithHashButNoParents()
        {
            using (var tempFolder = new TemporaryFolder())
            {
                var tempRepository = new TemporaryRepository(tempFolder);
                tempRepository.RunCommand("init");
                tempRepository.TouchFileAndCommit();

                var executor = new GitCommandExecutor(tempFolder.Path);
                var log      = new LogRetriever(executor).GetRecentCommits().ToArray();

                Assert.AreEqual(1, log.Length);

                var commit = log.Single();
                Assert.IsNotNullOrEmpty(commit.Hash);
                Assert.AreEqual(40, commit.Hash.Length);
                Assert.IsNull(commit.ParentHashes);
            }
        }