private void BrowseSolutionPath() { var oldSolutionPath = uxSolutionPath.Text; using (var openFileDialog = new OpenFileDialog()) { if (oldSolutionPath.IsNullOrWhiteSpace()) { openFileDialog.InitialDirectory = SolutionFileScanner.Scan(Assembly.GetExecutingAssembly().Location, true).FirstOrDefault()?.FileInfo?.DirectoryName; } else { openFileDialog.InitialDirectory = oldSolutionPath; } openFileDialog.Filter = "Visual Studio Solution (*.sln)|*.sln"; openFileDialog.Title = "Select a Visual Studio Solution file..."; openFileDialog.CheckPathExists = true; openFileDialog.AddExtension = true; openFileDialog.Multiselect = false; var result = openFileDialog.ShowDialog(); if (!(new DialogResult[] { DialogResult.Yes, DialogResult.OK }.Contains(result))) { AppState.SolutionPath = oldSolutionPath; } else { AppState.SolutionPath = openFileDialog.FileName; } UpdateSolutionPath(); } }
public void Returns_empty_collection_when_no_solutions_are_found() => SolutionFileScanner.Scan( path: Environment.CurrentDirectory, searchRecursivelyInTopDirectories: false) .Should().HaveCount(0);
public void Can_find_containing_solution() => SolutionFileScanner.Scan( path: Environment.CurrentDirectory, searchRecursivelyInTopDirectories: true) .Should().HaveCount(1);
private static Solution GetCurrentSolutionFile() => SolutionFileScanner.Scan( path: Environment.CurrentDirectory, searchRecursivelyInTopDirectories: true) .First();