Exemplo n.º 1
0
        public void CombineWithMoveNonIdenticalStatements()
        {
            // Part of a fix for something found in the wild. When we move statements, with append turned off, and
            // move turned on, make sure the move occurs.

            var inline1 = new StatementInlineBlock();
            var inline2 = new StatementInlineBlock();

            var s1 = new StatementSimpleStatement("dude", true);

            inline1.Add(s1);
            var s2 = new StatementSimpleStatement("fork", true);

            inline2.Add(s2);

            Assert.IsFalse(inline2.Combine(new IStatement[] { s1 }, inline1, appendIfCantCombine: false, moveIfIdentical: true), "Combine of two idential statements should go");
            Assert.AreEqual(1, inline1.Statements.Count(), "All statements should have been removed from block 1");
            Assert.AreEqual(1, inline2.Statements.Count(), "statements in inlien2");
        }
        public void CombineWithMoveNonAndNotNonIdenticalStatements()
        {
            // Part of a fix for something found in the wild. When we move statements, with append turned off, and
            // move turned on, make sure the move occurs.

            var inline1 = new StatementInlineBlock();
            var inline2 = new StatementInlineBlock();

            var s1 = new StatementSimpleStatement("dude", true);
            var s11 = new StatementSimpleStatement("fork", true);
            inline1.Add(s1);
            inline1.Add(s11);
            var s2 = new StatementSimpleStatement("fork", true);
            inline2.Add(s2);

            Assert.IsFalse(inline2.Combine(new IStatement[] { s1, s11 }, inline1, appendIfCantCombine: false, moveIfIdentical: true), "Combine of two idential statements should go");
            Assert.AreEqual(1, inline1.Statements.Count(), "All statements should have been removed from block 1");
            Assert.AreEqual(1, inline2.Statements.Count(), "statements in inlien2");
        }