Ejemplo n.º 1
0
        // parse the assembly definitions using metadata reader
        public MethodParser(string assemblyPath)
        {
            var comReader = new ComReader(assemblyPath);

            foreach (MetadataMethod method in comReader.getMethodsWithCustomAttribute(ComReader.exportAttribute))
            {
                var tokens = method.typeName.Split('.');
                if (tokens.Length > 1)
                {
                    methods.Add(new Method(method.name, tokens[0], tokens[1]));
                }
            }
        }
Ejemplo n.º 2
0
        public void testMethodWithCustomAttribute()
        {
            HashSet <string> methodNames = new HashSet <string>();
            HashSet <string> typeNames   = new HashSet <string>();

            foreach (MetadataMethod method in _comReader.getMethodsWithCustomAttribute(ComReader.exportAttribute))
            {
                methodNames.Add(method.name);
                typeNames.Add(method.typeName);
            }

            string[] expectedMethodNames = { "doClick", "doTest" };
            string[] expectedTypeNames   = { "JS.App" };

            Assert.AreEqual(expectedTypeNames, typeNames.ToArray());
            Assert.AreEqual(expectedMethodNames, methodNames.ToArray());
        }