Exemple #1
0
        public void MultiplicationInteger_TwoIntegers_ReturnsCorrectResultOfMultiplication(int input1, int input2, int expected)
        {
            IntegerLiteralExpression intLit1  = new IntegerLiteralExpression(input1.ToString(), 1, 1);
            IntegerLiteralExpression intLit2  = new IntegerLiteralExpression(input2.ToString(), 2, 2);
            MultiplicationExpression multExpr = new MultiplicationExpression(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.MultiplicationInteger(multExpr, new List <object>());

            Assert.AreEqual(expected, res);
        }