private void Populate_OnClick(object sender, RoutedEventArgs e) { var cursor = Cursors.Arrow; Dispatcher.Invoke(() => { cursor = Cursor; Cursor = Cursors.Wait; }); ClearAll(); _solution = new SolutionParser(new ProjectEnumerator(), new DacParserBuilder(), this); Dispatcher.Invoke(() => { Projects.ItemsSource = _solution.GetProjects(); Cursor = cursor; Populate.IsEnabled = true; }); }
public void Finds_All_Projects() { var projectList = new List <ProjectDescriptor>(); var project = new ProjectDescriptor(); const string projectName = "abcdef"; project.Name = projectName; const string path = "c:\\dac.dacpac"; project.DacPath = path; projectList.Add(project); var enumerator = new Mock <ProjectEnumerator>(); enumerator.Setup(p => p.EnumerateProjects()).Returns(projectList); var tables = new List <ITable>(); tables.Add(new Table()); var parser = new Mock <DacParser>(); parser.Setup(p => p.PreDeployScript).Returns(() => null); parser.Setup(p => p.PostDeployScript).Returns(() => null); parser.Setup(p => p.GetTableDefinitions()).Returns(tables); var parserBuilder = new Mock <DacParserBuilder>(); parserBuilder.Setup(p => p.Build(path)).Returns(parser.Object); var solution = new SolutionParser(enumerator.Object, parserBuilder.Object, new DummyStatus()); var actualProject = solution.GetProject(projectName); Assert.AreEqual(projectName, actualProject.GetName()); Assert.AreEqual(1, solution.GetProjects().Count); }
static void Main(string[] args) { var options = new Options(); if (!CommandLine.Parser.Default.ParseArguments(args, options)) { return; } Logger logger; if (options.OutputFormat?.Trim().ToLowerInvariant() == "vsts") { logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.VstsExtensionLog() .CreateLogger(); } else { logger = new LoggerConfiguration() .MinimumLevel.Information() .WriteTo.Console() .CreateLogger(); } var path = options.SolutionFilePath; var projectParser = new ProjectParser(logger); var solutionParser = new SolutionParser(path, projectParser, logger); var projects = solutionParser.GetProjects(); var packageProjectsGrouper = new PackageReferenceProjectsGrouper(); var packageProjectsGrouping = packageProjectsGrouper.Group(projects); foreach (var grouping in packageProjectsGrouping) { logger.Information("{Package} {Version} is being referenced by the projects: {Projects}" , grouping.Name , grouping.Version , grouping.Projects.Select(p => p.Name)); } var comparer = new ProjectsPackageReferencesComparer(); var packageReferenceDifferences = comparer.Compare(projects); foreach (var difference in packageReferenceDifferences) { if (difference.VersionDifferences.Count > 0) { logger.Warning("{Package} has multiple versions {Versions} referenced in different projects" , difference.PackageName , difference.VersionDifferences.Select(versionDifference => versionDifference.Version)); foreach (var versionDifference in difference.VersionDifferences) { logger.Warning("{Package} {Version} referenced in projects {Projects}", difference.PackageName, versionDifference.Version, versionDifference.ProjectNames); } } } }