Example #1
0
        private IList ConvertToSingleDeclarationStatements(MultipleVariableDeclarationStatement varDecl)
        {
            IList newStmts = new ArrayList();

            int index = 0;
            ExpressionCollection initExps = varDecl.InitExpressions;

            foreach (Identifier ident in varDecl.Identifiers)
            {
                // Here we are converting expression from
                // x:int, y:long = 1, 2L
                // to an AST representation equivalent to
                // x:int = 1; y:long = 2L

                SingleVariableDeclarationStatement svStmt = new SingleVariableDeclarationStatement(ident);

                if (index < initExps.Count)
                {
                    svStmt.InitExp = initExps[index];
                    EnsureNoPostFixStatement(svStmt.InitExp);
                }

                index++;

                newStmts.Add(svStmt);
            }

            // We don't need them anymore
            initExps.Clear();

            return(newStmts);
        }
Example #2
0
        public void TestClearWithoutItemsInCollection()
        {
            ExpressionCollection <INUnitFilterBaseElement> collection =
                new ExpressionCollection <INUnitFilterBaseElement>(NUnitFilterTestHelper.XmlAndTag);

            Assert.AreEqual(0, collection.Count);

            collection.Clear();

            Assert.AreEqual(0, collection.Count);
        }
Example #3
0
        public void TestClearWithItemsInCollection()
        {
            // Create collection
            const int count = 3;
            ExpressionCollection <INUnitFilterBaseElement> collection =
                NUnitFilterTestHelper.CreateCollection(count, out _);

            Assert.AreEqual(count, collection.Count);

            collection.Clear();

            Assert.AreEqual(0, collection.Count);
        }