Ejemplo n.º 1
0
        public void Can_Evaluate_Assignments()
        {
            var assignment  = "x = (2 + 2) * 5";
            var parseResult = _engine.ParseString(assignment);

            Assert.IsTrue(parseResult.IsAssignmentResult);
            Assert.AreEqual("x", (parseResult as AssignmentResult).Item.Variable);
            Assert.AreEqual(20, _engine.EvaluateExpression <int>((parseResult as AssignmentResult).Item.Expression));
        }
Ejemplo n.º 2
0
 public void RefreshResult()
 {
     try
     {
         var result = _engine.EvaluateExpression <T>(_expression);
         EvaluatedResult = result;
         IsEvaluated     = true;
     }
     catch (CyclicVertexException ex)
     {
         throw;
     }
     catch //not ideal .. maybe change the F# engine to return an evaluation result with true/false for IsEvaluated
     {
         EvaluatedResult = default(T);
         IsEvaluated     = false;
     }
 }