Exemple #1
0
        public void BuildDirectoryTree()
        {
            var repo = new TestRepository(
                workingDir: s_root,
                commitSha: null,
                submodules: new[]
            {
                new TestSubmodule(null, "c/x", null, null),
                new TestSubmodule(null, "e", null, null),
                new TestSubmodule(null, "a", null, null),
                new TestSubmodule(null, "a/a/a/a/", null, null),
                new TestSubmodule(null, "c", null, null),
                new TestSubmodule(null, "a/z", null, null),
            });

            var root = GitOperations.BuildDirectoryTree(repo);

            string inspect(GitOperations.SourceControlDirectory node)
            => node.Name + (node.RepositoryFullPath != null ? $"!" : "") + "{" + string.Join(",", node.OrderedChildren.Select(inspect)) + "}";

            var expected = IsUnix ?
                           "{/{usr{src!{a!{a{a{a!{}}},z!{}},c!{x!{}},e!{}}}}}" :
                           "{C:{src!{a!{a{a{a!{}}},z!{}},c!{x!{}},e!{}}}}";

            Assert.Equal(expected, inspect(root));
        }