Exemplo n.º 1
0
        public void FindAllMethodsFromArrayWithParameterCountReturnsExpectedMethods()
        {
            DefaultClass  c       = CreateClass();
            DefaultMethod method1 = new DefaultMethod(c, "abc");

            method1.Parameters.Add(CreateParameter("a"));

            DefaultMethod method2 = new DefaultMethod(c, "abc");

            method2.Parameters.Add(CreateParameter("a"));
            method2.Parameters.Add(CreateParameter("b"));

            DefaultMethod method3 = new DefaultMethod(c, "abc");

            method3.Parameters.Add(CreateParameter("c"));

            ArrayList items = new ArrayList();

            items.Add(method1);
            items.Add(method2);
            items.Add(method3);

            List <IMethod> expectedMethods = new List <IMethod>();

            expectedMethods.Add(method1);
            expectedMethods.Add(method3);

            int            parameterCount = 1;
            List <IMethod> methods        = PythonCompletionItemsHelper.FindAllMethodsFromCollection("abc", parameterCount, items);

            Assert.AreEqual(expectedMethods, methods);
        }
Exemplo n.º 2
0
        public void MethodGroupContainingTypeHasTwoExitMethods()
        {
            IReturnType    returnType = MethodResolveResult.ContainingType;
            List <IMethod> methods    = PythonCompletionItemsHelper.FindAllMethodsFromCollection("exit", returnType.GetMethods());

            Assert.AreEqual(2, methods.Count);
        }
Exemplo n.º 3
0
        public void FindAllMethodsFromArrayReturnsExpectedMethods()
        {
            DefaultClass  c       = CreateClass();
            DefaultMethod method1 = new DefaultMethod(c, "abc");
            DefaultMethod method2 = new DefaultMethod(c, "abc");
            DefaultMethod method3 = new DefaultMethod(c, "def");

            ArrayList items = new ArrayList();

            items.Add(method1);
            items.Add(method2);
            items.Add(method3);

            List <IMethod> expectedMethods = new List <IMethod>();

            expectedMethods.Add(method1);
            expectedMethods.Add(method2);

            List <IMethod> methods = PythonCompletionItemsHelper.FindAllMethodsFromCollection("abc", items);

            Assert.AreEqual(expectedMethods, methods);
        }
Exemplo n.º 4
0
        List <IMethod> GetExitMethods()
        {
            List <IMethod> methods = MethodResolveResult.ContainingType.GetMethods();

            return(PythonCompletionItemsHelper.FindAllMethodsFromCollection("exit", -1, methods.ToArray()));
        }
        List <IMethod> GetRoundMethods(int parameterCount)
        {
            List <IMethod> methods = MethodResolveResult.ContainingType.GetMethods();

            return(PythonCompletionItemsHelper.FindAllMethodsFromCollection("round", parameterCount, methods.ToArray()));
        }