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); }
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()); }
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); }