Example #1
0
        public void AdditionInteger_TwoIntegers_ReturnsCorrectResultOfAddition(int input1, int input2, int expected)
        {
            IntegerLiteralExpression intLit1 = new IntegerLiteralExpression(input1.ToString(), 1, 1);
            IntegerLiteralExpression intLit2 = new IntegerLiteralExpression(input2.ToString(), 2, 2);
            AdditionExpression       addExpr = new AdditionExpression(intLit1, intLit2, 1, 1);
            IInterpreterInteger      parent  = Substitute.For <IInterpreterInteger>();

            parent.DispatchInt(intLit1, Arg.Any <List <object> >()).Returns(input1);
            parent.DispatchInt(intLit2, Arg.Any <List <object> >()).Returns(input2);
            IntegerHelper integerHelper = SetUpHelper(parent);

            int res = integerHelper.AdditionInteger(addExpr, new List <object>());

            Assert.AreEqual(expected, res);
        }