예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddresses"/> class.
 /// </summary>
 /// <param name="localPartSource">
 /// Randomizer for the local part
 /// </param>
 /// <param name="domainNameSource">
 /// Randomizer for the domain part
 /// </param>
 /// <param name="topLevelDomain">
 /// The top level domain
 /// </param>
 public EmailAddresses(
     IRandomizerPlugin <string> localPartSource,
     IRandomizerPlugin <string> domainNameSource,
     string topLevelDomain)
 {
     this.topLevelDomain   = topLevelDomain;
     this.localPartSource  = localPartSource;
     this.domainNameSource = domainNameSource;
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Collectionizer{T,TRandomizer}"/> class.
        /// </summary>
        /// <param name="randomizerToUse">The randomizer which will be used. Use this if you want
        /// to specifiy how the randomizer to use should work</param>
        /// <param name="minCount">Min count of list items</param>
        /// <param name="maxCount">Max count of list items</param>
        public Collectionizer(TRandomizer randomizerToUse, uint minCount, uint maxCount)
        {
            if (randomizerToUse == null)
            {
                randomizerToUse = new TRandomizer();
            }

            if (minCount > maxCount)
            {
                maxCount = minCount;
                minCount = maxCount;
            }

            this.randomizerToUse = randomizerToUse;
            this.minCount        = (int)minCount;
            this.maxCount        = (int)maxCount;
        }
예제 #3
0
 /// <summary>
 /// Creates a random value of the target type. It will use a <see cref="IRandomizerPlugin{T}"/> for that
 /// </summary>
 /// <param name="randomizerPlugin"><see cref="IRandomizerPlugin{T}"/> to use</param>
 /// <returns>A random value of type <typeparamref name="T"/></returns>
 public static T Create(IRandomizerPlugin <T> randomizerPlugin)
 {
     Setup.TypeToRandomFunc[typeof(T)] = () => randomizerPlugin.GetValue();
     return(randomizerPlugin.GetValue());
 }
예제 #4
0
 /// <summary>
 /// Creates a set of random items of the given type and will use a <see cref="IRandomizerPlugin{T}"/> for that.
 /// </summary>
 /// <param name="randomizerPlugin">Plugin to use.</param>
 /// <param name="amount">Amount of items created.</param>
 /// <returns>Set of random items of the given type.</returns>
 public static IEnumerable <T> Create(IRandomizerPlugin <T> randomizerPlugin, int amount)
 {
     return(Create(amount, () => Create(randomizerPlugin)));
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddresses"/> class.
 /// </summary>
 /// <param name="localPartSource">
 /// The local part source.
 /// </param>
 /// <param name="domainNameSource">
 /// The domain name source.
 /// </param>
 public EmailAddresses(IRandomizerPlugin <string> localPartSource, IRandomizerPlugin <string> domainNameSource)
     : this(localPartSource, domainNameSource, ".com")
 {
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EmailAddresses"/> class.
 /// </summary>
 /// <param name="localPartSource">
 /// Randomizer for the local part
 /// </param>
 public EmailAddresses(IRandomizerPlugin <string> localPartSource)
     : this(localPartSource, new MnemonicString(1), ".com")
 {
 }
 /// <summary>
 /// Defines which implementation of the <see cref="IRandomizerPlugin{T}"/> interface will be used to generate a value for the given <see cref="TTargetType"/>
 /// </summary>
 /// <param name="randomizerPlugin">A <see cref="IRandomizerPlugin{TTargetType}"/> which will be used to generate a value of the <see cref="TTargetType"/></param>
 /// <returns>Main FluentFiller API</returns>
 public FluentFillerApi <TTargetObject> Use(IRandomizerPlugin <TTargetType> randomizerPlugin)
 {
     return(this.Use(randomizerPlugin.GetValue));
 }