Class ZonedDateTimeGenerator
Draws date-times in time zones, shrinking toward 2000-01-01T00:00 in UTC. The engine draws the zone, then a wall-clock time in it, and reads that time against the zone source: one draw in twenty on average lands on or beside one of the zone's transitions, which is how skipped and repeated times are reached. See ZonedDateTimes() for how bad arguments are reported.
public sealed class ZonedDateTimeGenerator : ValueGenerator<ZonedDateTime>
- Inheritance
-
ZonedDateTimeGenerator
- Inherited Members
Methods
AllowImaginary(bool)
Whether wall-clock times the clocks skipped are drawn (they are not by default). One is reported with Skipped, the offset in force after the clocks changed, and the instant its wall clock reads with the offset before.
public ZonedDateTimeGenerator AllowImaginary(bool allow)
Parameters
allowbool
Returns
Ambiguous(Ambiguous)
Which instant a repeated wall-clock time means: by default either, shrinking to the earlier.
public ZonedDateTimeGenerator Ambiguous(Ambiguous ambiguous)
Parameters
ambiguousAmbiguous
Returns
Exceptions
- ArgumentException
ambiguousis not a policy.
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 ZonedDateTime DoDraw(TestCase tc)
Parameters
tcTestCase
Returns
Max(DateTime)
A wall-clock time no later than max, in whichever zone is drawn.
public ZonedDateTimeGenerator Max(DateTime max)
Parameters
maxDateTime
Returns
Exceptions
- ArgumentException
maxis not of Unspecified; the instant is bounded too, and only one of the two can be; or the settings given so far allow no value.
Max(DateTimeOffset)
An instant no later than max.
public ZonedDateTimeGenerator Max(DateTimeOffset max)
Parameters
maxDateTimeOffset
Returns
Exceptions
- ArgumentException
The wall-clock time is bounded too, and only one of the two can be; or the settings given so far allow no value.
Min(DateTime)
A wall-clock time no earlier than min, in whichever zone is drawn.
public ZonedDateTimeGenerator Min(DateTime min)
Parameters
minDateTime
Returns
Exceptions
- ArgumentException
minis not of Unspecified; the instant is bounded too, and only one of the two can be; or the settings given so far allow no value.
Min(DateTimeOffset)
An instant no earlier than min.
public ZonedDateTimeGenerator Min(DateTimeOffset min)
Parameters
minDateTimeOffset
Returns
Exceptions
- ArgumentException
The wall-clock time is bounded too, and only one of the two can be; or the settings given so far allow no value.
Precision(Precision)
Only wall-clock times of day that are whole numbers of precision since midnight, rather than of ticks.
public ZonedDateTimeGenerator Precision(Precision precision)
Parameters
precisionPrecision
Returns
Exceptions
- ArgumentException
precisionis not a precision, or the settings given so far allow no value.
Source(ZoneSource)
Read wall-clock times against source rather than the default zone source,
and draw its zones unless Zones(Generator<TimeZoneInfo>) gives others.
public ZonedDateTimeGenerator Source(ZoneSource source)
Parameters
sourceZoneSource
Returns
Exceptions
- ArgumentException
Zones(Generator<TimeZoneInfo>) was given a generator from Zones(), which carries its own source; or
sourcehas no zone to draw.
Zones(Generator<TimeZoneInfo>)
The zones to draw: any generator of them, such as Generators.Temporal.Zones().Names(...) or
Generators.Just(zone). A generator from Zones() brings its
zone source with it. A zone from any other generator is looked up in this generator's zone
source by its Id (or, for a Windows id the source has no zone
under, by the IANA name .NET maps it to), and one the source does not have fails the draw
with a HegelUsageException naming it.
public ZonedDateTimeGenerator Zones(Generator<TimeZoneInfo> zones)
Parameters
zonesGenerator<TimeZoneInfo>
Returns
Exceptions
- ArgumentException
zonescame from Zones() and Source(ZoneSource) was also called.