/// <summary>
        /// Returns list of projects in a repository and its depending repositories sorted by dependencies
        /// </summary>
        /// <param name="buildConfig"></param>
        /// <returns></returns>
        private List <DotNetProjectInfo> FindAllProjects(DotNetProjectBuildConfig buildConfig)
        {
            var projects = new List <DotNetProjectInfo>();

            AddProjectsOfRepository(buildConfig.GitRepository, projects);

            _dotNetProjectDependencyFiller.Fill(projects);

            var allSortedProjectList = _buildProjectListSorter.SortByDependencies(
                projects,
                new DotNetProjectInfoEqualityComparer()
                );

            FilterIgnoredDirectories(allSortedProjectList, buildConfig.GitRepository);

            return(allSortedProjectList);
        }
        public void SortByDependencies_Test()
        {
            // A -> B, C
            // B -> D
            // D -> F
            // F -> C
            // C -> G
            // Final build order must be: G,

            var repositoryName = "volo";
            var source         = new List <DotNetProjectInfo>
            {
                new DotNetProjectInfo(repositoryName, "A", true)
                {
                    Dependencies = new List <DotNetProjectInfo>()
                    {
                        new DotNetProjectInfo(repositoryName, "B", true),
                        new DotNetProjectInfo(repositoryName, "C", true)
                    }
                },
                new DotNetProjectInfo(repositoryName, "B", true)
                {
                    Dependencies = new List <DotNetProjectInfo>()
                    {
                        new DotNetProjectInfo(repositoryName, "D", true)
                    }
                },
                new DotNetProjectInfo(repositoryName, "D", true)
                {
                    Dependencies = new List <DotNetProjectInfo>()
                    {
                        new DotNetProjectInfo(repositoryName, "F", true)
                    }
                },
                new DotNetProjectInfo(repositoryName, "F", true)
                {
                    Dependencies = new List <DotNetProjectInfo>()
                    {
                        new DotNetProjectInfo(repositoryName, "C", true)
                    }
                },
                new DotNetProjectInfo(repositoryName, "C", true)
                {
                    Dependencies = new List <DotNetProjectInfo>()
                    {
                        new DotNetProjectInfo(repositoryName, "G", true)
                    }
                },
                new DotNetProjectInfo(repositoryName, "G", true)
            };

            var sortedDependencies =
                _buildProjectListSorter.SortByDependencies(source, new DotNetProjectInfoEqualityComparer());

            sortedDependencies.Count.ShouldBe(6);
            sortedDependencies[0].CsProjPath.ShouldBe("G");
            sortedDependencies[1].CsProjPath.ShouldBe("C");
            sortedDependencies[2].CsProjPath.ShouldBe("F");
            sortedDependencies[3].CsProjPath.ShouldBe("D");
            sortedDependencies[4].CsProjPath.ShouldBe("B");
            sortedDependencies[5].CsProjPath.ShouldBe("A");
        }