Esempio n. 1
0
        public void FindMethodInvocation_With_EmptyArguments()
        {
            const string methodName       = "invokedMethod1";
            var          methodInvocation = PythonCodeGenerator.GenerateMethodInvocation(methodName, new string[] { }, 0);

            var finder = BuildFinder(methodInvocation);
            var argumentsWithWithMethodInvocationType =
                finder.FindArgumentCollection().FindArgumentsWithMethodInvocationType();
            var argumentsWithWithVariableType = finder.FindArgumentCollection().FindArgumentsWithVariableType();

            Assert.AreEqual(0, argumentsWithWithMethodInvocationType.Count());
            Assert.AreEqual(0, argumentsWithWithVariableType.Count());
        }
Esempio n. 2
0
        public void FindMethodInvocationWithVariableArguments()
        {
            const string methodName       = "invokedMethod1";
            var          arguments        = new[] { "arg1", "arg2" };
            var          methodInvocation = PythonCodeGenerator.GenerateMethodInvocation(methodName, arguments, 0);

            var finder                    = BuildFinder(methodInvocation);
            var invokedMethodName         = finder.FindIdentifier().FindIdentifier().FirstOrDefault();
            var argumentsWithVariableType = finder.FindArgumentCollection().FindArgumentsWithVariableType();


            Assert.AreEqual(methodName, invokedMethodName);
            Assert.AreEqual(2, argumentsWithVariableType.Count());
        }
Esempio n. 3
0
        public void FindMethodInvocation_WithMethodInvocation_Arguments()
        {
            const string nestedInvokedMethodName = "argInvokedMethod";
            var          nestedArguments         = new[] { "arg1", "arg2" };
            var          mainArgument            =
                PythonCodeGenerator.GenerateMethodInvocation(nestedInvokedMethodName, nestedArguments, 0);

            const string mainInvokedMethodName = "invokedMethod1";
            var          methodInvocation      =
                PythonCodeGenerator.GenerateMethodInvocation(mainInvokedMethodName, new[] { mainArgument }, 0);

            var finder = BuildFinder(methodInvocation);
            var argumentsWithWithMethodInvocationType =
                finder.FindArgumentCollection().FindArgumentsWithMethodInvocationType();
            var argumentsWithWithVariableType = finder.FindArgumentCollection().FindArgumentsWithVariableType();

            Assert.AreEqual(1, argumentsWithWithMethodInvocationType.Count());
            Assert.AreEqual(0, argumentsWithWithVariableType.Count());
        }