private static IEnumerable <ProjectNugetsGrouping> ParseProjectsFromDirectory(ILogger logger, string directory) { var finder = new ProjectPackagesFinder(logger); var packagesConfigFiles = finder.Find(directory); var parser = new ProjectPackagesParser(logger, new FileReader()); return(packagesConfigFiles.Select(packagesConfigFile => parser.Parse(packagesConfigFile))); }
public void TestProjectWithoutPackagesFile() { var packagesConfigFile = new ProjectPackagesFile(ProjectName); var target = new ProjectPackagesParser(Mock.Of <ILogger>(), Mock.Of <IFileReader>()); var actual = target.Parse(packagesConfigFile); actual.ProjectName.Should().Be(ProjectName); actual.Nugets.Should().BeEmpty(); }
public void TestProjectWithPackagesFile(TestData testData) { var packagesConfigFile = new ProjectPackagesFile(ProjectName, "path"); var mockFileReader = new Mock <IFileReader>(); mockFileReader .Setup(fileReader => fileReader.ReadFileContents( It.Is <string>(value => value == packagesConfigFile.PackagesFilePath) )) .Returns(testData.PackagesConfigContent); var target = new ProjectPackagesParser(Mock.Of <ILogger>(), mockFileReader.Object); var actual = target.Parse(packagesConfigFile); actual.ProjectName.Should().Be(testData.ExpectedProjectNugetsGrouping.ProjectName); actual.Nugets.Should().ContainInOrder(testData.ExpectedProjectNugetsGrouping.Nugets); }