public void ToStringTest()
 {
     ExpressionParam target = new ExpressionParam("X", 1);
     string expected = "X:1";
     string actual;
     actual = target.ToString();
     Assert.AreEqual(expected, actual);
 }
Exemple #2
0
        public ExpressionParam[] GetExpressionParameters()
        {
            var p = new ExpressionParam[this.expressionParameters.Count];

            this.expressionParameters.CopyTo(p);

            return(p);
        }
        public void EqualsTest()
        {
            ExpressionParam target = new ExpressionParam("X", 1);
            Assert.IsFalse(target.Equals(null));
            Assert.IsFalse(target.Equals("test"));

            object other = new ExpressionParam("X", 1);
            Assert.IsTrue(target.Equals(other));
            Assert.IsTrue(target.GetHashCode() == other.GetHashCode());

            other = new ExpressionParam("x", 1);
            Assert.IsFalse(target.Equals(other));
            Assert.IsFalse(target.GetHashCode() == other.GetHashCode());

            other = new ExpressionParam("X", 2);
            Assert.IsFalse(target.Equals(other));
        }
 public double Evaluate(string expression, ExpressionParam[] parameters = null)
 {
     var exp = new Expression(expression);
     IEvaluator eval = CreateEvaluator(exp);
     return eval.Evaluate(parameters);
 }