public void testCategory1Attribute() { String statement = "define Person as category with attribute id "; ETestParser parser = new ETestParser(statement, false); CategoryDeclaration cd = parser.parse_category_declaration(); Assert.IsNotNull(cd); Assert.AreEqual("Person", cd.GetName()); Assert.IsNull(cd.getDerivedFrom()); Assert.IsNotNull(cd.GetLocalAttributes()); Assert.IsTrue(cd.GetLocalAttributes().Contains("id")); }
public void parsesCategory1Attribute() { String statement = "category Person ( id );"; OTestParser parser = new OTestParser(statement); CategoryDeclaration cd = parser.parse_category_declaration(); Assert.IsNotNull(cd); Assert.AreEqual("Person", cd.GetName()); Assert.IsNull(cd.getDerivedFrom()); Assert.IsNotNull(cd.GetLocalAttributes()); Assert.IsTrue(cd.GetLocalAttributes().Contains("id")); }
public void testCategory2DerivedNoAttribute() { String statement = "define Entrepreneur as Person and Company"; ETestParser parser = new ETestParser(statement, false); CategoryDeclaration cd = parser.parse_category_declaration(); Assert.IsNotNull(cd); Assert.AreEqual("Entrepreneur", cd.GetName()); Assert.IsNotNull(cd.getDerivedFrom()); Assert.IsTrue(cd.getDerivedFrom().Contains("Person")); Assert.IsTrue(cd.getDerivedFrom().Contains("Company")); Assert.IsNull(cd.GetLocalAttributes()); }
public void parsesCategory2DerivedNoAttribute() { String statement = "category Entrepreneur extends Person, Company;"; OTestParser parser = new OTestParser(statement); CategoryDeclaration cd = parser.parse_category_declaration(); Assert.IsNotNull(cd); Assert.AreEqual("Entrepreneur", cd.GetName()); Assert.IsNotNull(cd.getDerivedFrom()); Assert.IsTrue(cd.getDerivedFrom().Contains("Person")); Assert.IsTrue(cd.getDerivedFrom().Contains("Company")); Assert.IsNull(cd.GetLocalAttributes()); }
public void parsesCategory1Derived1Attribute() { String statement = "category Employee( company ) extends Person ;"; OTestParser parser = new OTestParser(statement); CategoryDeclaration cd = parser.parse_category_declaration(); Assert.IsNotNull(cd); Assert.AreEqual("Employee", cd.GetName()); Assert.IsNotNull(cd.getDerivedFrom()); Assert.IsTrue(cd.getDerivedFrom().Contains("Person")); Assert.IsNotNull(cd.GetLocalAttributes()); Assert.IsTrue(cd.GetLocalAttributes().Contains("company")); }