コード例 #1
0
        public void ParseNoArgumentsTest()
        {
            //Parse tokens
            MarkupParser markupParser = new MarkupParser(Init("()"));
            Markup       markup       = new Markup();

            markupParser.ParseArguments(markup);

            //Test arguments
            Assert.AreEqual(0, markup.GetArguments().Count);
        }
コード例 #2
0
        public void ParseAttrArgumentTest()
        {
            //Parse tokens
            MarkupParser markupParser = new MarkupParser(Init("(i = 1)"));
            Markup       markup       = new Markup();

            markupParser.ParseArguments(markup);

            //Test arguments
            Assert.AreEqual(1, markup.GetArguments().Count);
            Argument argument = (Argument)markup.GetArguments().Get(0);

            Assert.AreEqual(typeof(AttrArgument), argument.GetType());

            //Test specific argument
            AttrArgument attrArgument = (AttrArgument)argument;

            Assert.AreEqual("i", attrArgument.GetIdentifier());
            Assert.AreEqual(typeof(NumExpression), attrArgument.GetExpression().GetType());
        }
コード例 #3
0
        public void ParseExpressionArgumentTest()
        {
            //Parse tokens
            MarkupParser markupParser = new MarkupParser(Init("([1234,2345,3556,646])"));
            Markup       markup       = new Markup();

            markupParser.ParseArguments(markup);

            //Test argument
            Assert.AreEqual(1, markup.GetArguments().Count);
            Argument[] arguments = (Argument[])markup.GetArguments().ToArray();
            Assert.AreEqual(typeof(ExpressionArgument), arguments[0].GetType());

            //Test expression argument
            ExpressionArgument exprArgument = (ExpressionArgument)arguments[0];

            Assert.AreEqual(typeof(ListExpression), exprArgument.GetExpression().GetType());

            //Test list expression
            ListExpression listExpression = (ListExpression)exprArgument.GetExpression();

            Assert.AreEqual(4, listExpression.GetExpressions().Count);
        }