public void Test1()
        {
            var formatter = new VisualStudioCodeElementsFormatter();

            MethodIdentifier methodIdentifier = formatter.CreateIdentifier(_methodName, _params);

            methodIdentifier.ToString().ShouldEqual(_expected);
        }
Ejemplo n.º 2
0
        public bool GetCurrentClassAndMethod(out MethodIdentifier methodIdentifier)
        {
            methodIdentifier = null;
            //EnvDTE80.vsCMParameterKind.vsCMParameterKin
            CodeFunction methodAtCaret = new VisualStudioCodeSearcher().GetMethodAtCaret(_dte);

            if (methodAtCaret != null)
            {
                var parameters = methodAtCaret.Parameters.Cast <CodeParameter2>().ToList();
                var names      = parameters.Select(p => GetKindString(p)
                                                   + (string.IsNullOrEmpty(p.Type.AsFullName) ? TranslateTypeName(p.Type.AsString)
                    : p.Type.AsFullName)).ToList();

                methodIdentifier = new VisualStudioCodeElementsFormatter()
                                   .CreateIdentifier(methodAtCaret.FullName, names);
                return(true);
            }
            return(false);
        }