コード例 #1
0
        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));
        }
コード例 #2
0
        public void DelegatedEntityValidatorAttributeIsSerializable()
        {
            TestsContext.AssumeSystemTypeIsSerializable();
            var attributeInstance = new DelegatedValidatorAttribute(new DelegatedConstraint <Dummy>((i, c) => i.Value > 0));

            NHAssert.IsSerializable(attributeInstance);
        }
コード例 #3
0
        public void DelegatedEntityValidatorAttributeIsSerializable()
        {
            var attributeInstance = new DelegatedValidatorAttribute(new DelegatedConstraint <Dummy>((i, c) => i.Value > 0));

            Assert.That(attributeInstance, Is.BinarySerializable);
        }
コード例 #4
0
        public IChainableConstraint <IDateTimeConstraints <T> > Satisfy(Func <T, bool> isValidDelegate)
        {
            var attribute = new DelegatedValidatorAttribute(new DelegatedSimpleConstraint <T>(isValidDelegate));

            return(AddWithConstraintsChain(attribute));
        }
コード例 #5
0
        public IChainableConstraint <IFloatConstraints <T> > Satisfy(Func <T, IConstraintValidatorContext, bool> isValidDelegate)
        {
            var attribute = new DelegatedValidatorAttribute(new DelegatedConstraint <T>(isValidDelegate));

            return(AddWithConstraintsChain(attribute));
        }
コード例 #6
0
        public IChainableConstraint <ICollectionConstraints <TElement> > Satisfy(Func <IEnumerable <TElement>, bool> isValidDelegate)
        {
            var attribute = new DelegatedValidatorAttribute(new DelegatedSimpleConstraint <IEnumerable <TElement> >(isValidDelegate));

            return(AddWithConstraintsChain(attribute));
        }
コード例 #7
0
        public IChainableConstraint <IStringConstraints> Satisfy(Func <string, bool> isValidDelegate)
        {
            var attribute = new DelegatedValidatorAttribute(new DelegatedSimpleConstraint <string>(isValidDelegate));

            return(AddWithConstraintsChain(attribute));
        }