public void ProjectsTargetCorrectFrameworkVersion() { const string xpath = @"/p:Project/p:PropertyGroup/p:TargetFrameworkVersion"; var ns = new ProjectFileNamespaceManager(); var paths = ProjectFilePaths(SrcPath) .Concat(ProjectFilePaths(SrcPath, "*.scproj")) .ToArray(); Assert.NotEmpty(paths); foreach (var path in paths) { _output.WriteLine($"Testing {path}"); var nodes = XDocument .Load(path) .XPathSelectElements(xpath, ns) .ToArray(); Assert.Single(nodes); Assert.True(nodes.First().Value == "<%= framework %>"); _output.WriteLine($"Passed: {path}"); } ProjectFilesContainNode(SrcPath, xpath); }
/// <summary>Test that project files contain a specific node.</summary> /// <param name="fsPath">The path to search for project files.</param> /// <param name="xPath">The node to test for.</param> private void ProjectFilesContainNode(string fsPath, string xPath) { var ns = new ProjectFileNamespaceManager(); var paths = ProjectFilePaths(fsPath).ToArray(); Assert.NotEmpty(paths); foreach (var path in paths) { _output.WriteLine($"Testing {path}"); var node = XDocument.Load(path).XPathSelectElement(xPath, ns); Assert.NotNull(node); _output.WriteLine($"Passed: {path}"); } }