public void AbsoluteInteger_SetWithEmptyList_ReturnsLength() { IdentifierExpression intLit = new IdentifierExpression("", 1, 1); AbsoluteValueExpression absExpr = new AbsoluteValueExpression(intLit, 1, 1); absExpr.Type = TypeEnum.Set; IInterpreterInteger parent = Substitute.For <IInterpreterInteger>(); parent.DispatchSet(intLit, Arg.Any <List <object> >()).Returns(new Set(new List <Element>())); IntegerHelper integerHelper = SetUpHelper(parent); int res = integerHelper.AbsoluteInteger(absExpr, new List <object>()); Assert.AreEqual(0, res); }
public void AbsoluteInteger_Integer_ReturnsAbsoluteValue(int input, int expected) { IntegerLiteralExpression intLit = new IntegerLiteralExpression(input.ToString(), 1, 1); AbsoluteValueExpression absExpr = new AbsoluteValueExpression(intLit, 1, 1); absExpr.Type = TypeEnum.Integer; IInterpreterInteger parent = Substitute.For <IInterpreterInteger>(); parent.DispatchInt(intLit, Arg.Any <List <object> >()).Returns(input); IntegerHelper integerHelper = SetUpHelper(parent); int res = integerHelper.AbsoluteInteger(absExpr, new List <object>()); Assert.AreEqual(expected, res); }