Example #1
0
        /// <summary>
        /// Ignores a property or field when <seealso cref="StrictMode"/> is enabled.
        /// </summary>
        public virtual Faker <T> Ignore <TPropertyOrField>(Expression <Func <T, TPropertyOrField> > propertyOrField)
        {
            var propNameOrField = PropertyName.For(propertyOrField);

            return(Ignore(propNameOrField));
        }
Example #2
0
        /// <summary>
        /// Creates a rule for a compound property and providing access to the instance being generated.
        /// </summary>
        public virtual Faker <T> RuleFor <TProperty>(Expression <Func <T, TProperty> > property, Func <Faker, T, TProperty> setter)
        {
            var propName = PropertyName.For(property);

            return(AddRule(propName, (f, t) => setter(f, t)));
        }
Example #3
0
        /// <summary>
        /// Creates a rule for a property.
        /// </summary>
        public virtual Faker <T> RuleFor <TProperty>(Expression <Func <T, TProperty> > property, Func <TProperty> valueFunction)
        {
            var propName = PropertyName.For(property);

            return(AddRule(propName, (f, t) => valueFunction()));
        }