public void GetsReferences(string projectFile) { // Given StringWriter log = new StringWriter(); ProjectAnalyzer analyzer = GetProjectAnalyzer(projectFile, log); // When IReadOnlyList <string> references = analyzer.GetReferences(); // Then references.ShouldContain(x => x.EndsWith("mscorlib.dll"), log.ToString()); if (projectFile.Contains("PackageReference")) { references.ShouldContain(x => x.EndsWith("Newtonsoft.Json.dll"), log.ToString()); } }
private static IEnumerable <MetadataReference> GetMetadataReferences(ProjectAnalyzer analyzer) => analyzer .GetReferences() ?.Where(File.Exists) .Select(x => MetadataReference.CreateFromFile(x)) ?? (IEnumerable <MetadataReference>)Array.Empty <MetadataReference>();