Example #1
0
        /// <summary>
        /// Verify repo layout.
        /// The tree verifies the correctness of the filenames and contents.
        /// The commit verifies the correctness of the commit message, author, and date, too.
        /// </summary>
        /// <param name="repodir">The repo dir.</param>
        /// <param name="refs">Refs to inspect</param>
        /// <param name="commit">(optional) The expected commit sha.</param>
        /// <param name="tree">(optional) The expected tree sha.</param>
        private void AssertNewClone(string repodir, string[] refs, string commit = null, string tree = null)
        {
            const string format   = "{0}: {1} / {2}";
            var          expected = String.Join("\n", refs.Select(gitref => String.Format(format, gitref, commit, tree)));
            var          actual   = String.Join("\n", refs.Select(gitref =>
            {
                var actualCommit = h.RevParseCommit(repodir, gitref);
                return(String.Format(format, gitref,
                                     commit == null || actualCommit == null ? null : actualCommit.Sha,
                                     tree == null || actualCommit == null ? null : actualCommit.Tree.Sha));
            }));

            Assert.Equal(expected, actual);
        }