//public SolutionsViewModel(SolutionFileHelper fileHelper, Func<ProjectDependencyContext> getDbContext, Func<VistaFolderBrowserDialog> getFolderBrowser) public SolutionsViewModel(SolutionFileHelper fileHelper, Func <VistaFolderBrowserDialog> getFolderBrowser) { _fileHelper = fileHelper ?? throw new ArgumentNullException(nameof(fileHelper)); //_getDbContext = getDbContext ?? throw new ArgumentNullException(nameof(getDbContext)); _getFolderBrowser = getFolderBrowser ?? throw new ArgumentNullException(nameof(getFolderBrowser)); DisplayName = @"Solutions View"; //LoadSolutionsFromDb(); }
public void SolutionFileHelper_Test1() { var solutionFile = @"TestFiles\\MerlinTransformSolution.txt"; var settings = new TestParserSettings(); var parser = new SolutionParser( s => new DotNetSolution(s), x => new DotNetProject(x), settings); var sut = new SolutionFileHelper(settings, parser); var t = new Version(); SolutionFileData actualSolution; try { actualSolution = sut.ReadSolutionFileAsync(solutionFile).Result; } catch (Exception ex) { TestContext.WriteLine("Error {0} while reading file {1}", ex, solutionFile); throw; } var actualProjects = new List <ProjectFileData>(); foreach (var projectFile in actualSolution.ProjectFiles) { try { actualProjects.Add(sut.ReadProjectFileAsync(actualSolution, projectFile).Result); } catch (Exception ex) { TestContext.WriteLine("Error {0} while reading file {1}", ex, projectFile.ProjectPath); throw; } } // TODO: split into 2 tests! var actual = new { Solution = actualSolution, Projects = actualProjects }; var json = JsonConvert.SerializeObject(actual); Approvals.VerifyJson(json); }