public void f() { var input = @"#r ""./a/b.dll"" using System; "; var tree = CSharpSyntaxTree.ParseText(input); var root = (CompilationUnitSyntax)tree.GetRoot(); var collector = new ReferenceDirectiveTriviaCollector(); collector.Visit(root); Assert.Equal(1, collector.Reference.Count); Assert.Equal("./a/b.dll", collector.Reference.First()); }
public void g() { var input = @"#r ""./a/b.dll"" #r ""./c/d.dll"" #r ""./e.dll"" using System; "; var tree = CSharpSyntaxTree.ParseText(input); var root = (CompilationUnitSyntax)tree.GetRoot(); var collector = new ReferenceDirectiveTriviaCollector(); collector.Visit(root); var ret = new string[] { "./a/b.dll", "./c/d.dll", "./e.dll" }.ToHashSet(); Assert.Equal(3, collector.Reference.Count); foreach (var x in collector.Reference) { Assert.Contains(x, ret); } }