public void modifies_the_validation_node() { var modification = new ValidationNodeModification(null, x => x.Clear()); var node = new AjaxValidationNode(ActionCall.For<FormValidationModeEndpoint>(x => x.post_ajax(null))); var chain = new BehaviorChain(); chain.AddToEnd(node); modification.Modify(chain); node.ShouldHaveCount(0); }
public static void ApplyValidation(ActionCall call, ValidationSettings settings) { BehaviorNode node; if (call.ResourceType().CanBeCastTo <AjaxContinuation>()) { node = new AjaxValidationNode(call); } else { var builder = typeof(LoFiValidationNodeBuilder <>).CloseAndBuildAs <IValidationNodeBuilder>(call.InputType()); node = builder.BuildNode(); } call.AddBefore(node); settings.Modify(call.ParentChain()); }