Can this engine apply rules to input to produce output - or is it strictly for validation?

Sep 15, 2014 at 2:20 PM
Example:

Say that I want to determine the customer service phone # applying to a given user based on rules looking at where the user lives and their age.

Does this engine support this -- or is it strictly intended for validation?
Coordinator
Sep 22, 2014 at 11:11 AM
Sorry, at this stage, Rules engine (perhaps not the best name for the framework) is strictly intended for validation
Mar 18, 2015 at 9:34 AM
You can hack the engine to perform actions for you, if you make a rule for your complex object:

class AddDiscountToUserIfUnderAge : IRule<User>
{
    #region Implementation of IRule

    public ValidationResult Validate(User value)
    {
        if (value.Age < 18)
        {
            value.Fee = value.Fee*0.5; //50% discount for users under the age of 18
        }
        return ValidationResult.Success;
    }

    public string RuleKind { get { return GetType().Name; } }
    #endregion
}
And then add the rule as follows:
     For<User>().MustPassRule(new AddDiscountToUserIfUnderAge());
Hope this helps :)