public IChainableConstraint <IInstanceConstraints <TEntity> > By(Func <TEntity, IConstraintValidatorContext, bool> isValidDelegate) { var attribute = new DelegatedValidatorAttribute(new DelegatedConstraint <TEntity>(isValidDelegate)); parent.AddClassConstraint(attribute); return(new ChainableConstraint <IInstanceConstraints <TEntity> >(this, attribute)); }
public void DelegatedEntityValidatorAttributeIsSerializable() { TestsContext.AssumeSystemTypeIsSerializable(); var attributeInstance = new DelegatedValidatorAttribute(new DelegatedConstraint <Dummy>((i, c) => i.Value > 0)); NHAssert.IsSerializable(attributeInstance); }
public void DelegatedEntityValidatorAttributeIsSerializable() { var attributeInstance = new DelegatedValidatorAttribute(new DelegatedConstraint <Dummy>((i, c) => i.Value > 0)); Assert.That(attributeInstance, Is.BinarySerializable); }
public IChainableConstraint <IDateTimeConstraints <T> > Satisfy(Func <T, bool> isValidDelegate) { var attribute = new DelegatedValidatorAttribute(new DelegatedSimpleConstraint <T>(isValidDelegate)); return(AddWithConstraintsChain(attribute)); }
public IChainableConstraint <IFloatConstraints <T> > Satisfy(Func <T, IConstraintValidatorContext, bool> isValidDelegate) { var attribute = new DelegatedValidatorAttribute(new DelegatedConstraint <T>(isValidDelegate)); return(AddWithConstraintsChain(attribute)); }
public IChainableConstraint <ICollectionConstraints <TElement> > Satisfy(Func <IEnumerable <TElement>, bool> isValidDelegate) { var attribute = new DelegatedValidatorAttribute(new DelegatedSimpleConstraint <IEnumerable <TElement> >(isValidDelegate)); return(AddWithConstraintsChain(attribute)); }
public IChainableConstraint <IStringConstraints> Satisfy(Func <string, bool> isValidDelegate) { var attribute = new DelegatedValidatorAttribute(new DelegatedSimpleConstraint <string>(isValidDelegate)); return(AddWithConstraintsChain(attribute)); }