public void testClassifierAttribute_05() { CoreClassifier film = (CoreClassifier)environment.lookup("Film"); CoreOperation operation = film.lookupOperation("getTapes", null); Assert.AreEqual(0, operation.getSpecifications().Count); List <object> constraints = doTestManyContextOK("context Film::getTapes() : Set(Tape) post: self.rentalFee@pre = 10 ", getCurrentMethodName()); film = (CoreClassifier)environment.lookup("Film"); operation = film.lookupOperation("getTapes", null); Assert.AreEqual(1, operation.getSpecifications().Count); OclPrePostConstraint constraint = (OclPrePostConstraint)operation.getSpecifications()[0]; OclPostConstraint post = (OclPostConstraint)constraint.getPostConditions()[0]; OclExpression oclExpression = ((ExpressionInOclImpl)post.getExpression()).getBodyExpression(); this.checkOperationCallExp(((OperationCallExp)oclExpression), "=", "Boolean"); OperationCallExp opCall = (OperationCallExp)((OperationCallExp)oclExpression); AttributeCallExp attExp = checkAttributeCallExp(opCall.getSource(), "rentalFee", "Integer"); opCall = (OperationCallExp)((AttributeCallExp)opCall.getSource()).getSource(); this.checkOperationCallExp(opCall, "atPre", "Film"); checkImplicitSource(opCall, "self", "Film"); }
public void addPostCondition(OclPostConstraint constraint) { this.postConditions.Add(constraint); }