Ejemplo n.º 1
0
        /// <summary>
        ///     Sets a collection property on the constructed instance, generating a list using the defact builder for the type of
        ///     the property.
        /// </summary>
        /// <typeparam name="TProp">The type of the property to set.</typeparam>
        /// <param name="selector">A delegate which specifies the property to set.</param>
        public Builder <TInstance> With <TProp>(Expression <Func <TInstance, ICollection <TProp> > > selector) where TProp : class, new()
        {
            var propBuilder = BuilderRegistry.Resolve <TProp>();

            return(With(selector, 2.Times(propBuilder.Build).ToList()));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Sets a property on the constructed instance, generated using the default builder for the type of the property.
        /// </summary>
        /// <typeparam name="TProp">The type of the property to set.</typeparam>
        /// <param name="selector">A delegate which specifies the property to set.</param>
        public Builder <TInstance> With <TProp>(Expression <Func <TInstance, TProp> > selector) where TProp : class, new()
        {
            var propBuilder = BuilderRegistry.Resolve <TProp>();

            return(With(selector, propBuilder.Build()));
        }