Esempio n. 1
0
 public void Can_Evaluate_Expression_As_ConditionalRule()
 {
     var statement = "return (this.Price > 20 or this.Price < 15)";
     var order = new Order { Price = 10, Message = "Soemthing" };
     EvaluatorAccessPoint.DslConditionEvaluator = evaluator;
     var condition = new DslCondition { DslStatement = statement };
     var rule = new ConditionalRule(condition);
     Assert.IsTrue(rule.Evaluate(order));
 }
Esempio n. 2
0
 public void Can_Evaluate_Expression_As_ActionActivityRule()
 {
     var statement = "return (this.Price > 20 or this.Price < 15)";
     var order = new Order { Price = 10, Message = "Soemthing" };
     EvaluatorAccessPoint.DslConditionEvaluator = evaluator;
     var condition = new DslCondition { DslStatement = statement };
     var rule = new ActivityRule(condition, new ActionActivity<Order>(t =>
                                                                          {
                                                                              t.Message = "amp";
                                                                          }));
     Assert.IsTrue(rule.Evaluate(order));
     Assert.AreEqual("amp", order.Message);
 }
Esempio n. 3
0
     public void Can_Evaluate_Expression_With_DslActivity()
     {
         var statement = "return (this.Price > 20 or this.Price < 15)";
         var order = new Order { Price = 10, Message = "Something" };
         EvaluatorAccessPoint.DslConditionEvaluator = evaluator;
         var condition = new DslCondition { DslStatement = statement };
         var rule = new ActivityRule(condition, new DslActivity
                                                    {
                                                        DslStatement = @"
 this.Message = ""dsl"";
 return true;"
                                                    });
         Assert.IsTrue(rule.Evaluate(order));
         Assert.AreEqual("dsl", order.Message);
     }