Beispiel #1
0
        public void GetAllMethodsTest()
        {
            var expected = new List <MethodDeclarationSyntax>
            {
                testAnalysis.GetMethodDeclSyntax("int ExampleCode2.BaseClass.Method1(int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode2.DerivedAbstractClass.Method1(int)"),
                testAnalysis.GetMethodDeclSyntax("double ExampleCode2.DerivedAbstractClass.Method2()"),
                testAnalysis.GetMethodDeclSyntax("double ExampleCode2.DerivedConcreteClass.Method2()"),
                testAnalysis.GetMethodDeclSyntax("bool ExampleCode2.DerivedConcreteClass.Method3(bool)")
            };
            var actual = testAnalysis.GetAllMethods();

            CollectionAssert.AreEqual(expected, actual);
        }
        public void GetAllMethodsTest()
        {
            var expected = new List <MethodDeclarationSyntax>
            {
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C1.M1(int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C1.M2(int, int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C1.M3(int, bool, string)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C2.M2(int, int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C2.M3(int, bool, string)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C2.M4(int, int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C3_1.M3(int, bool, string)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C3_1.M4(int, int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C3_2.M4(int, int)"),
                testAnalysis.GetMethodDeclSyntax("int ExampleCode1.C3_2.M5(int)")
            };
            var actual = testAnalysis.GetAllMethods();

            CollectionAssert.AreEqual(expected, actual);
        }
        public void ClassOverridesOrHidesMethodTest1()
        {
            var expected = false;
            var actual   = testAnalysis.ClassOverridesOrHidesMethod(testAnalysis.GetClassDeclSyntax("ExampleCode3.B"), testAnalysis.GetMethodDeclSyntax("int ExampleCode3.A.M(ExampleCode3.IA)"));

            Assert.AreEqual(expected, actual);
        }