コード例 #1
0
        public void DispatchReal_AdditionAndObjectList_CorrectListPassed()
        {
            List <Object> expected = new List <Object>()
            {
                23, 2.334, null
            };
            AdditionExpression input1      = new AdditionExpression(null, null, 0, 0);
            IRealHelper        rhelper     = Substitute.For <IRealHelper>();
            Interpreter        interpreter = Utilities.GetIntepreterOnlyWith(rhelper);
            List <Object>      res         = null;

            rhelper.AdditionReal(Arg.Any <AdditionExpression>(), Arg.Do <List <Object> >(x => res = x));

            interpreter.DispatchReal(input1, expected);

            res.Should().BeEquivalentTo(expected);
        }
コード例 #2
0
        public void DispatchReal_AdditionAndObjectList_CorrectValueReturned()
        {
            double             expected = 17;
            AdditionExpression input1   = new AdditionExpression(null, null, 0, 0);
            List <Object>      input2   = new List <Object>()
            {
                23, 2.334, null
            };
            IRealHelper rhelper     = Substitute.For <IRealHelper>();
            Interpreter interpreter = Utilities.GetIntepreterOnlyWith(rhelper);

            rhelper.AdditionReal(Arg.Any <AdditionExpression>(), Arg.Any <List <Object> >()).Returns(expected);

            double res = interpreter.DispatchReal(input1, input2);

            Assert.AreEqual(expected, res);
        }
コード例 #3
0
        public void Dispatch_AdditionAndObjectListAndRealType_CorrectAdditionExprPassed()
        {
            AdditionExpression expected = new AdditionExpression(null, null, 0, 0);
            AdditionExpression input1   = expected;
            List <Object>      input2   = new List <Object>()
            {
                23, 2.334, null
            };
            IRealHelper        rhelper     = Substitute.For <IRealHelper>();
            Interpreter        interpreter = Utilities.GetIntepreterOnlyWith(rhelper);
            AdditionExpression res         = null;

            rhelper.AdditionReal(Arg.Do <AdditionExpression>(x => res = x), Arg.Any <List <Object> >());

            interpreter.Dispatch(input1, input2, TypeEnum.Real);

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