public void TestAssignmentVarChanger()
        {
            TestCase testCase = TestCase.GetLocalVarAssignmentCode();
            var      stmt     = Helpers.GetFirstNodeOfType <ExpressionStatementSyntax>(testCase.Code);

            var coll = new StatementInfoCollector();
            var info = coll.Collect(stmt);

            Assert.IsFalse(info.IsLocalVarDeclaration);
            Assert.IsTrue(info.IsLocalVarStateChanger);

            Assert.IsTrue(info.LocalVarNames.Contains("localVar1"));
        }
Exemplo n.º 2
0
        public void TestLocalVarDeclarationHooks()
        {
            HookedRenderInfoGenerator generator = new HookedRenderInfoGenerator();
            ClassInfo classInfo = TestCase.GetLocalVarAssignmentCode().ClassInfo;

            int id = 0;

            CodeRunBlockRenderingInfo renderInfo = generator.CodeRunBlockRenderInfoForMethod(classInfo, id);

            Assert.IsTrue(renderInfo.renderingInfo[0][0].Contains("OnMethodEnter"));
            Assert.IsTrue(renderInfo.renderingInfo[0][1].Contains("LogLineRun"));
            Assert.IsTrue(renderInfo.renderingInfo[0][2].Contains("0"));
            Assert.IsTrue(renderInfo.renderingInfo[0][3].Contains("LocalVarUpdate"));
            Assert.IsTrue(renderInfo.renderingInfo[0][3].Contains("localVar1"));
            Assert.IsTrue(renderInfo.renderingInfo[0][4].Contains("LogLineRun"));
            Assert.IsTrue(renderInfo.renderingInfo[0][5].Contains("1"));
            Assert.IsTrue(renderInfo.renderingInfo[0][6].Contains("LocalVarUpdate"));
            Assert.IsTrue(renderInfo.renderingInfo[0][6].Contains("localVar1"));
        }