Пример #1
0
        public void TestFunction4()
        {
            RegexForCSharp regex = new RegexForCSharp();
            var            found = regex.FindFunctionDefinitions("CSharpProjectInformation cSharpProjectInformation = new CSharpProjectInformation();");

            Assert.AreEqual(0, found.Count);
        }
Пример #2
0
        public void TestFunction3()
        {
            RegexForCSharp regex = new RegexForCSharp();
            var            found = regex.FindDefinedFunctions("                found.Add(varname);");

            Assert.AreEqual(0, found.Count);
        }
Пример #3
0
        public void TestVariable()
        {
            RegexForCSharp regex = new RegexForCSharp();
            var            found = regex.FindVariables("Files.ForEach(file =>            {                found.AddRange(func(File.ReadAllText(file)));            }); ");

            Assert.AreEqual(1, found.Count);
            Assert.AreEqual("file", found[0]);
        }
Пример #4
0
        public void TestFunction2()
        {
            RegexForCSharp regex = new RegexForCSharp();
            var            found = regex.FindDefinedFunctions("public void Build(IBuilder builder)");

            Assert.AreEqual(1, found.Count);
            Assert.AreEqual("Build", found[0]);
        }
Пример #5
0
        public void TestFunction()
        {
            RegexForCSharp regex = new RegexForCSharp();
            var            found = regex.FindDefinedFunctions(" void TestMethod1()");

            Assert.AreEqual(1, found.Count);
            Assert.AreEqual("TestMethod1", found[0]);
        }
Пример #6
0
        public void Build(ICommandBuilder builder)
        {
            RegexForCSharp regex    = new RegexForCSharp();
            LineFinder     lineFine = new LineFinder();

            builder.AddCommand("Function", () => lineFine.FindLine(regex.FindFunctionDefinitions));
            builder.AddCommand("class", () => lineFine.FindLine(regex.FindClassDefinitions));
        }