public void ConditionFunction_ConditionNodeAndObjectList_ReturnsCorrectResult(int input, int expected)
        {
            IdentifierExpression id            = new IdentifierExpression("", 1, 1);
            ConditionNode        conditionNode = new ConditionNode(id, 1, 1);
            IInterpreterGeneric  parent        = Substitute.For <IInterpreterGeneric>();

            parent.Dispatch(id, Arg.Any <List <Object> >(), Arg.Any <TypeEnum>()).Returns(new Function(input));
            GenericHelper functionHelper = SetUpHelper(parent);

            int res = functionHelper.Condition <Function>(conditionNode, new List <Object>()).Element.Reference;

            Assert.AreEqual(expected, res);
        }
        public void ConditionFunction_ConditionNodeAndObjectList_ReturnsNull()
        {
            IdentifierExpression id            = new IdentifierExpression("", 1, 1);
            ConditionNode        conditionNode = new ConditionNode(id, id, 1, 1);
            IInterpreterGeneric  parent        = Substitute.For <IInterpreterGeneric>();

            parent.Dispatch(id, Arg.Any <List <Object> >(), Arg.Any <TypeEnum>()).Returns(false);
            GenericHelper functionHelper = SetUpHelper(parent);
            bool          expected       = false;

            bool res = functionHelper.Condition <Function>(conditionNode, new List <Object>()).IsCalculated;

            Assert.AreEqual(expected, res);
        }
        public void ConditionFunction_ConditionNodeAndObjectList_CorrectListPassed()
        {
            IdentifierExpression id            = new IdentifierExpression("", 1, 1);
            ConditionNode        conditionNode = new ConditionNode(id, 1, 1);
            IInterpreterGeneric  parent        = Substitute.For <IInterpreterGeneric>();
            List <Object>        res           = null;

            parent.Dispatch(id, Arg.Do <List <Object> >(x => res = x), Arg.Any <TypeEnum>()).Returns(new Function(0));
            List <Object> expected = new List <Object> {
                1, 1.3, ""
            };
            GenericHelper functionHelper = SetUpHelper(parent);

            functionHelper.Condition <Function>(conditionNode, expected);

            res.Should().BeEquivalentTo(expected);
        }