public static void ParsePackagesConfigFileContent_ReturnsExpectedResult() { var content = Helpers.ReadEmbeddedResourceFile("packages.config.txt"); var result = PackageConfigParser.ParsePackagesConfigFileContent(content).ToArray(); Assert.That(result, Is.Not.Null); Assert.Multiple( () => { Assert.That(result.Length, Is.EqualTo(1)); Assert.That(result[0].Name, Is.EqualTo("Cake")); Assert.That(result[0].Version, Is.EqualTo("0.17.0")); // todo Do more asserts here. } ); }
internal void ProcessPackagesConfig(ProjectMetadata projectMetadata, SourceInformation projectDirectory) { _logger.Trace("Entering"); var packagesConfig = Tools.GetChildFileInformation( new SourceInformation(projectDirectory), "packages.config"); var sourceTool = GetSourceTool(); var sw = Stopwatch.StartNew(); var content = sourceTool.GetItemContent(packagesConfig); sw.Stop(); _logger.Trace($"GetItemContent took {sw.Elapsed}"); if (content != null) { projectMetadata.PackageReferences = PackageConfigParser.ParsePackagesConfigFileContent(content).ToList(); } }
public static void ParsePackagesConfigFileContent_Throws(string input) { Assert.Throws <ArgumentException>(() => PackageConfigParser.ParsePackagesConfigFileContent(input)); }