static void Main(string[] args) { ConfigurationManager.Load(); Parser.Default.ParseArguments <Options>(args) .WithParsed(options => { ConfigurationManager.Config.CodeRootFolders = options.CodeRootFolders.ToArray(); // Override the Config.yaml with the command line argument if (options.GeneratedMungeSlnFile != null) { ConfigurationManager.Config.GeneratedMungeSlnFile = options.GeneratedMungeSlnFile; } ConfigurationManager.FixupSettings(); var generator = new ProjectDependencyCalculator(); var projectExclusionList = ConfigurationManager.Config.MainApplications .Single(x => x.Name == options.MainApplication).Exclusions; var data = generator.GetAllDependenciesRequiredForProject(ConfigurationManager.Config.CodeRootFoldersAbsolute.ToList(), options.ExcludeProjectFolders.ToList(), options.MainApplication, options.IncludeTestProjects, projectExclusionList); var builder = new MungeSolutionBuilder(ConfigurationManager.Config.GeneratedMungeSlnFileAbsolute); builder.Create(data, null, Con.WriteLine, options.CodeRootFolders); }); }
public void GetAllDependenciesRequiredForProject_WithoutTests() { var expectedResults = new List <ProjectInfo> { new ProjectInfo { PackageName = "MainApplication", PackageReferences = new List <string> { "MyLibrary" }, ProjectName = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestData\MainGitRepo\MainApplication\MainApplication.csproj"), ProjectReferences = new List <string>(), Visited = true, }, new ProjectInfo { PackageName = "MyLibrary", PackageReferences = new List <string>(), ProjectName = Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestData\MainGitRepo\MyLibrary\MyLibrary.csproj"), ProjectReferences = new List <string>(), Visited = true, } }; var results = new ProjectDependencyCalculator().GetAllDependenciesRequiredForProject( ConfigurationManager.Config.CodeRootFoldersAbsolute.ToList(), excludeProjectFolders: new List <string>(), "MainApplication", includeTestProjects: false, GetProjectExclusionList("MainApplication")); results.Should().BeEquivalentTo(expectedResults); }