/// <summary> /// Replace fully qualified class name with shortest uniquely qualified name. /// /// For example, in presence of Rhino.Geometry.Point, replace /// /// Autodesk.Geometry.Point.ByCoordinates(...) /// /// with /// /// Autodesk.Point.ByCoordinates(...) /// </summary> /// <param name="classTable"></param> /// <param name="asts">Input ASTs</param> /// <param name="resolver"></param> public static void ReplaceWithShortestQualifiedName(ClassTable classTable, IEnumerable <AssociativeNode> asts, ElementResolver resolver = null) { ShortestQualifiedNameReplacer replacer = new ShortestQualifiedNameReplacer(classTable, resolver); foreach (var ast in asts) { ast.Accept(replacer); } }
public void VisitTypedIdentifierNodeTest() { //Arrange var engine = CurrentDynamoModel.EngineController; ShortestQualifiedNameReplacer replacer = new ShortestQualifiedNameReplacer(engine.LibraryServices.LibraryManagementCore.ClassTable, null); TypedIdentifierNode node = null; IdentifierListNode node2 = null; //Act //We need to pass null to both functions in order to reach a specific piece of code wihout coverage var response = replacer.VisitTypedIdentifierNode(node); var response2 = replacer.VisitIdentifierListNode(node2); //Assert //Checking that both functions returned null Assert.IsNull(response); Assert.IsNull(response2); }