AjScript.Tests.Interpreter.ParserTests.ParseSimpleBinaryExpressionWithParenthesis C# (CSharp) Method

ParseSimpleBinaryExpressionWithParenthesis() private method

private ParseSimpleBinaryExpressionWithParenthesis ( ) : void
return void
        public void ParseSimpleBinaryExpressionWithParenthesis()
        {
            IExpression expression = this.ParseExpression("((a) + (2))");

            Assert.IsNotNull(expression);
            Assert.IsInstanceOfType(expression, typeof(ArithmeticBinaryExpression));

            ArithmeticBinaryExpression operation = (ArithmeticBinaryExpression)expression;

            Assert.AreEqual(ArithmeticOperator.Add, operation.Operation);
            Assert.IsNotNull(operation.LeftExpression);
            Assert.IsInstanceOfType(operation.LeftExpression, typeof(VariableExpression));
            VariableExpression varexpr = (VariableExpression)operation.LeftExpression;
            Assert.AreEqual("a", varexpr.Name);
            Assert.IsNotNull(operation.RightExpression);
            Assert.IsInstanceOfType(operation.RightExpression, typeof(ConstantExpression));
        }
ParserTests