Пример #1
0
        public void TestOptionalParams()
        {
            Fixed     fixedFunc = new Fixed();
            ValueEval Evaluate  = fixedFunc.Evaluate(0, 0, new NumberEval(1234.56789));

            Assert.IsTrue(Evaluate is StringEval);
            Assert.AreEqual("1,234.57", ((StringEval)Evaluate).StringValue);

            Evaluate = fixedFunc.Evaluate(0, 0, new NumberEval(1234.56789), new NumberEval(1));
            Assert.IsTrue(Evaluate is StringEval);
            Assert.AreEqual("1,234.6", ((StringEval)Evaluate).StringValue);

            Evaluate = fixedFunc.Evaluate(0, 0, new NumberEval(1234.56789), new NumberEval(1), BoolEval.TRUE);
            Assert.IsTrue(Evaluate is StringEval);
            Assert.AreEqual("1234.6", ((StringEval)Evaluate).StringValue);

            Evaluate = fixedFunc.Evaluate(new ValueEval[] { }, 1, 1);
            Assert.IsTrue(Evaluate is ErrorEval);

            Evaluate = fixedFunc.Evaluate(new ValueEval[] { new NumberEval(1), new NumberEval(1), new NumberEval(1), new NumberEval(1) }, 1, 1);
            Assert.IsTrue(Evaluate is ErrorEval);
        }