Exemple #1
0
 /// <summary>
 /// DateTimeOffset data generator that generates sequence of DateTimeOffset values
 /// with 0 offset, with the specified step and starting with the specified initial value.
 /// </summary>
 /// <param name="initialValue">The initial value.</param>
 /// <param name="step">The step for the sequence.</param>
 /// <param name="offset">The offset for the DateTimeOffset values.</param>
 /// <returns>DateTime data generator.</returns>
 public static IDataGenerator <DateTimeOffset> DateTimeOffsetSequence(DateTime initialValue, TimeSpan step, TimeSpan offset)
 {
     return(new DelegatedSeededDataGenerator <DateTimeOffset>(
                initialValue.Ticks,
                FromSeedStrategies.DateTimeOffsetFromSeed(offset),
                TryGetNextSeedStrategies.SequenceWithStep(step.Ticks)));
 }
Exemple #2
0
 /// <summary>
 /// TimeSpan data generator that generates sequence of TimeSpan values
 /// with the specified step and starting with the specified initial value.
 /// </summary>
 /// <param name="initialValue">The initial value.</param>
 /// <param name="step">The step for the sequence.</param>
 /// <returns>TimeSpan data generator.</returns>
 public static IDataGenerator <TimeSpan> TimeSpanSequence(TimeSpan initialValue, TimeSpan step)
 {
     return(new DelegatedSeededDataGenerator <TimeSpan>(
                initialValue.Ticks,
                FromSeedStrategies.TimeSpanFromSeed(),
                TryGetNextSeedStrategies.SequenceWithStep(step.Ticks)));
 }
Exemple #3
0
        /// <summary>
        /// Sequential data generator with unlimited capacity: generates repeated sequence starting from the seed and incrementing by the step
        /// Limit value is based on the data type.
        /// </summary>
        /// <typeparam name="TData">The type of the data.</typeparam>
        /// <param name="initialSeed">The initial seed of the generator</param>
        /// <param name="step">The amount to increment by</param>
        /// <returns>Sequential data generator with unlimited capacity.</returns>
        public static IDataGenerator <TData> RepeatedSequence <TData>(long initialSeed, long step)
        {
            long limit;

            if (!seedLimits.TryGetValue(typeof(TData), out limit))
            {
                limit = long.MaxValue;
            }

            return(new DelegatedSeededDataGenerator <TData>(
                       initialSeed,
                       FromSeedStrategies.ConvertSeed <TData>(),
                       TryGetNextSeedStrategies.RepeatedSequence(initialSeed, limit, step)));
        }
 /// <summary>
 /// Initializes a new instance of the DelegatedSeededDataGenerator class.
 /// Uses sequential strategy with step 1 to get next seed (i.e. nextSeed = seed + 1).
 /// </summary>
 /// <param name="initialSeed">The initial seed.</param>
 /// <param name="fromSeedDelegate">FromSeed delegate.</param>
 public DelegatedSeededDataGenerator(long initialSeed, Func <long, TData> fromSeedDelegate)
     : this(initialSeed, fromSeedDelegate, TryGetNextSeedStrategies.Sequence())
 {
 }