Esempio n. 1
0
        public void SubtractionInteger_TwoIntegers_ReturnsCorrectResultOfSubtraction(int input1, int input2, int expected)
        {
            IntegerLiteralExpression intLit1 = new IntegerLiteralExpression(input1.ToString(), 1, 1);
            IntegerLiteralExpression intLit2 = new IntegerLiteralExpression(input2.ToString(), 2, 2);
            SubtractionExpression    subExpr = new SubtractionExpression(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.SubtractionInteger(subExpr, new List <object>());

            Assert.AreEqual(expected, res);
        }