Locked Evaluation of enum rule parameters

  • 22 Juni 2011 5:55
     
     
    Is there a way to evaluate an enum parameter for a rule explicitly? Currently Spec Explorer seems to be passing the value on symbolically.
     
    To illustrate the point, I have the following rule:
    public enum ALModelRules { Add, Reset };
    [Rule(Action = "Add(rule)")]
    static void AddRule(ALModelRules rule)
    {
        throw new Exception(rule.ToString());
    }
    When exploring the model, Spec Explorer knows to call AddRule(Add) and AddRule(Reset), but the exception generated is always just "rule" no matter which version of the rule was executed.
    I wan't it to give me "Add" when AddRule(Add) is called and "Reset" when AddRule(Reset) is called.
    Thanks,
    Simon Ejsing

Semua Balasan

  • 22 Juni 2011 13:20
     
     Jawab

    Hi Simon,

    if "Combination.Expand(rule);" is added as the first line in your rule-method "AddRule", the parameter "rule" is expanded.
    Without this due to the exception, Spec Explorer skips the expansion. Hope this can help.


    • Ditandai sebagai Jawaban oleh Simon Ejsing 23 Juni 2011 5:34
    •  
  • 23 Juni 2011 5:35
     
     

    Thank you, this was exactly what I needed!

     

    -Simon