示例#1
0
        public void InvocationStatement_Static()
        {
            var actual   = SSTUtil.InvocationStatement(GetStaticMethod("B2"), Refs("c2"));
            var expected = new ExpressionStatement
            {
                Expression = new InvocationExpression
                {
                    MethodName = GetStaticMethod("B2"),
                    Parameters = { VarRefExpr("c2") }
                }
            };

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void InvocationStatement_NonStatic()
        {
            var actual   = SSTUtil.InvocationStatement("a", GetMethod("B2"), Refs("c2"));
            var expected = new ExpressionStatement
            {
                Expression = new InvocationExpression
                {
                    Reference = new VariableReference {
                        Identifier = "a"
                    },
                    MethodName = GetMethod("B2"),
                    Parameters = { VarRefExpr("c2") }
                }
            };

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void EPsAndNonEPsAreDistinguished()
        {
            CompleteInClass(@"$
                public void A() { B();}
                public void B() {}
                public void C() {}
            ");

            var mA = NewMethodDeclaration(Fix.Void, "A");

            mA.Body.Add(
                SSTUtil.InvocationStatement(
                    "this",
                    Names.Method("[System.Void, mscorlib, 4.0.0.0] [N.C, TestProject].B()"),
                    new ISimpleExpression[] {}));
            var mB = NewMethodDeclaration(Fix.Void, "B"); // ...

            mB.IsEntryPoint = false;
            var mC = NewMethodDeclaration(Fix.Void, "C");

            AssertAllMethods(mA, mB, mC);
        }