public static void TryGetForNameWhenAliasedWithSameName() { var tree = CSharpSyntaxTree.ParseText(@" namespace N { using String = System.String; public class C { public C(String s) { } } }"); Assert.AreEqual(true, AliasWalker.TryGet(tree, "String", out var directive)); Assert.AreEqual("using String = System.String;", directive.ToString()); Assert.AreEqual(false, AliasWalker.TryGet(tree, "string", out _)); }
public static void TryGetForName() { var tree = CSharpSyntaxTree.ParseText(@" namespace N { using A = NUnit.Framework.Assert; public class C { public C() { A.AreEqual(1, 1); } } }"); Assert.AreEqual(true, AliasWalker.TryGet(tree, "A", out var directive)); Assert.AreEqual("using A = NUnit.Framework.Assert;", directive.ToString()); Assert.AreEqual(false, AliasWalker.TryGet(tree, "C", out _)); }