コード例 #1
0
        public GeneratorOptions <T> For <TProperty>(
            Expression <Func <T, TProperty> > propertyExpression,
            TProperty seed,
            Func <TProperty, TProperty> valueFunc)
        {
            var generator = new FuncGenerator <TProperty>(seed, valueFunc);

            AddConvention(propertyExpression, () => generator.GetRandomValue());
            return(this);
        }
コード例 #2
0
        public GeneratorOptions <T> AppendCounter(Expression <Func <T, string> > propertyExpression, Func <string> prefix)
        {
            var generator = new FuncGenerator <long, string>(0, val => ++ val, val => val.ToString());

            return(For(propertyExpression, () => prefix() + generator.GetRandomValue()));
        }