Ejemplo n.º 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));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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()));
        }