Class DateTimeGenerator
Draws date-times without a time zone (Unspecified), shrinking toward 2000-01-01T00:00. See Dates() for how bad arguments are reported.
public sealed class DateTimeGenerator : ValueGenerator<DateTime>
- Inheritance
-
DateTimeGenerator
- Inherited Members
Methods
DoDraw(TestCase)
Draw one value. Called inside a span labelled Label: draw from another generator through DrawSilent<T>(Generator<T>), which opens its span, rather than by calling its hook.
protected override DateTime DoDraw(TestCase tc)
Parameters
tcTestCase
Returns
Max(DateTime)
No later than max.
public DateTimeGenerator Max(DateTime max)
Parameters
maxDateTime
Returns
Exceptions
- ArgumentException
The settings given so far allow no date-time.
Min(DateTime)
No earlier than min.
public DateTimeGenerator Min(DateTime min)
Parameters
minDateTime
Returns
Exceptions
- ArgumentException
The settings given so far allow no date-time.
Precision(Precision)
Only times of day that are whole numbers of precision since midnight, rather than of ticks.
public DateTimeGenerator Precision(Precision precision)
Parameters
precisionPrecision
Returns
Exceptions
- ArgumentException
precisionis not a precision, or the settings given so far allow no date-time.
WithOffsets(Generator<TimeSpan>)
These date-times paired with offsets from offsets, as DateTimeOffsets.
public PrintableGenerator<DateTimeOffset> WithOffsets(Generator<TimeSpan> offsets)
Parameters
Returns
WithTimeZones(Generator<TimeZoneInfo>)
These date-times read as local times in zones from zones, as
DateTimeOffsets (a zone's historical offset with seconds is truncated to minutes).
[Obsolete("Use Generators.Temporal.ZonedDateTimes().Zones(zones), whose values say which zone they are in and whether the wall-clock time was skipped or repeated; ZonedDateTime.ToDateTimeOffset() gives the DateTimeOffset.")]
public PrintableGenerator<DateTimeOffset> WithTimeZones(Generator<TimeZoneInfo> zones)
Parameters
zonesGenerator<TimeZoneInfo>