Пример #1
0
        public void CalculateIfElseTest()
        {
            var parameters = new ParameterCollection() { new Parameter("x", 10) };

            var cond = new Equal(new Variable("x"), new Number(10));
            var @if = new If(cond, new Number(20), new Number(0));

            Assert.AreEqual(20.0, @if.Calculate(parameters));

            parameters["x"] = 0;

            Assert.AreEqual(0.0, @if.Calculate(parameters));
        }
Пример #2
0
        public void CalculateElseTest()
        {
            var parameters = new ParameterCollection() { new Parameter("x", 0) };

            var cond = new Equal(new Variable("x"), new Number(10));
            var @if = new If(cond, new Number(20));

            @if.Calculate(parameters);
        }