コード例 #1
0
        public void testConstructor2AttributesAnd()
        {
            String                statement = "Company with 1 as id and \"IBM\" as name";
            ETestParser           parser    = new ETestParser(statement, false);
            ConstructorExpression c         = parser.parse_constructor_expression();

            Assert.IsNotNull(c);
            ArgumentList l = c.getArguments();

            Assert.IsNotNull(l);
            Assert.AreEqual(2, l.Count);
            Argument a = l[0];

            Assert.IsNotNull(a);
            Assert.AreEqual("id", a.GetName());
            IExpression e = a.getExpression();

            Assert.IsNotNull(e);
            Assert.IsTrue(e is IntegerLiteral);
            a = l[1];
            Assert.IsNotNull(a);
            Assert.AreEqual("name", a.GetName());
            e = a.getExpression();
            Assert.IsNotNull(e);
            Assert.IsTrue(e is TextLiteral);
        }
コード例 #2
0
        public void parsesConstructor2AttributesComma()
        {
            String                statement = "Company(id=1, name=\"IBM\")";
            OTestParser           parser    = new OTestParser(statement);
            ConstructorExpression c         = parser.parse_constructor_expression();

            Assert.IsNotNull(c);
            ArgumentList l = c.getArguments();

            Assert.IsNotNull(l);
            Assert.AreEqual(2, l.Count);
            Argument a = l[0];

            Assert.IsNotNull(a);
            Assert.AreEqual("id", a.GetName());
            IExpression e = a.getExpression();

            Assert.IsNotNull(e);
            Assert.IsTrue(e is IntegerLiteral);
            a = l[1];
            Assert.IsNotNull(a);
            Assert.AreEqual("name", a.GetName());
            e = a.getExpression();
            Assert.IsNotNull(e);
            Assert.IsTrue(e is TextLiteral);
        }