public void testIterateExp() { AstOclModelElementFactory factory1 = AstOclModelElementFactoryManager.getInstance(umlModel.getOclPackage()); VariableDeclaration variable = factory1.createVariableDeclaration("abc", getClassifier("Distributor"), null); VariableExp source = factory1.createVariableExp(variable); VariableDeclaration iter = factory1.createVariableDeclaration("iter", getClassifier("SpecialFilm"), null); VariableExp iterRef = factory1.createVariableExp(iter); CoreAttribute attr = getClassifier("SpecialFilm").lookupAttribute("lateReturnFee"); AttributeCallExp attCall = factory1.createAttributeCallExp(iterRef, attr, false); IntegerLiteralExp initExp = factory1.createIntegerLiteralExp(100, getClassifier("Integer")); VariableDeclaration result = factory1.createVariableDeclaration("result", getClassifier("Integer"), initExp); List <object> paramTypes = new List <object>(); paramTypes.Add(getClassifier("Integer")); CoreOperation oper = getClassifier("Integer").lookupOperation("+", paramTypes); VariableExp resultExp = factory1.createVariableExp(result); List <object> args = new List <object>(); args.Add(attCall); OclExpression body = factory1.createOperationCallExp(resultExp, oper, args, getClassifier("Integer"), false); List <object> iterators = new List <object>(); iterators.Add(iter); IterateExp exp = factory1.createIterateExp(getClassifier("Integer"), source, body, iterators, result); Assert.AreEqual("abc->iterate(iter : SpecialFilm ; result : Integer = 100 | result + iter.lateReturnFee)", exp.ToString()); Assert.AreEqual("Integer", exp.getType().getName()); }