Beispiel #1
0
        // ReSharper disable once InconsistentNaming
        static void Main(string[] args)
        {
            string xmlPath      = "";
            string assemblyPath = "";

            if (args.Length > 0)
            {
                if (args[0].Last() != '\\')
                {
                    xmlPath = args[0] + "\\";
                }
            }
            if (args.Length > 1)
            {
                assemblyPath = args[1];
            }

            StreamWriter file         = new StreamWriter(xmlPath + "methods.xml");
            MethodParser methodParser = assemblyPath == "" ? new MethodParser(typeof(JSHandler)) : new MethodParser(assemblyPath);

            file.Write(methodParser.writeToXml());
            file.Close();
        }
Beispiel #2
0
        public void testNamespaces()
        {
            MethodParser methodParser = new MethodParser(_assemblyPath);
            string[] expectedNamespaces = { "JS" };
            Assert.AreEqual(expectedNamespaces, methodParser.namespaces.ToArray());

            foreach(string namespaceName in methodParser.namespaces)
                Assert.AreEqual(_expectedMethodNames,methodParser.getMethodsByNamespace(namespaceName).Select(method => method.name).ToArray());
        }
Beispiel #3
0
        public void testClassNames()
        {
            MethodParser methodParser = new MethodParser(_assemblyPath);
            string[] expectedClassNames = { "App" };
            Assert.AreEqual(expectedClassNames, methodParser.classNames.ToArray());

            foreach (string className in methodParser.classNames)
                Assert.AreEqual(_expectedMethodNames, methodParser.getMethodsByClassName(className).Select(method => method.name).ToArray());
        }
Beispiel #4
0
 public void testXml()
 {
     MethodParser methodParser = new MethodParser(_assemblyPath);
     string expectedXML = "<MethodParser><methods><Method><name>doClick</name><parameters /><returnType>void</returnType><className>App</className><namespaceName>JS</namespaceName></Method><Method><name>doTest</name><parameters /><returnType>void</returnType><className>App</className><namespaceName>JS</namespaceName></Method></methods></MethodParser>";
     Assert.AreEqual(expectedXML, methodParser.writeToXml());
 }