/// <summary> /// Makes the behavior execute only if the condition against a model /// object pulled from IFubuRequest is true /// </summary> public void ConditionByModel <T>(Func <T, bool> filter) where T : class { var description = "By Model: Func<{0}, bool>".ToFormat(typeof(T).Name); Trace(new ConditionAdded(description)); _conditionalDef = ConditionalObjectDef.ForModel(filter); }
public void for_model_positive() { var model = new Model { Name = "Jeremy" }; theRequest.Set(model); var def = ConditionalObjectDef.ForModel <Model>(x => x.Name == "Jeremy"); var conditional = build(def); conditional.ShouldExecute().ShouldBeTrue(); // Change the name on the model should now make the test false model.Name = "Jessica"; conditional.ShouldExecute().ShouldBeFalse(); }
/// <summary> /// Makes the behavior execute only if the condition against a model /// object pulled from IFubuRequest is true /// </summary> public void ConditionByModel <T>(Func <T, bool> filter) where T : class { _conditionalDef = ConditionalObjectDef.ForModel(filter); }