Class OffsetGenerator
Draws UTC offsets, as TimeSpans east of UTC, shrinking toward zero: whole minutes between -14:00 and +14:00 by default, which is what a DateTimeOffset can hold. See Dates() for how bad arguments are reported.
public sealed class OffsetGenerator : ValueGenerator<TimeSpan>
- Inheritance
-
OffsetGenerator
- 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 TimeSpan DoDraw(TestCase tc)
Parameters
tcTestCase
Returns
Granularity(OffsetGranularity)
Only whole numbers of granularity, rather than of minutes.
public OffsetGenerator Granularity(OffsetGranularity granularity)
Parameters
granularityOffsetGranularity
Returns
Exceptions
- ArgumentException
granularityis not a granularity, or the settings given so far allow no offset.
Max(TimeSpan)
At most max, which may be as high as +25:59:59. The lower bound stays
-14:00 unless Min(TimeSpan) changes it.
public OffsetGenerator Max(TimeSpan max)
Parameters
maxTimeSpan
Returns
Exceptions
- ArgumentException
maxis not a whole number of seconds, or the settings given so far allow no offset.
Min(TimeSpan)
At least min, which may be as low as -25:59:59. The upper bound stays
+14:00 unless Max(TimeSpan) changes it.
public OffsetGenerator Min(TimeSpan min)
Parameters
minTimeSpan
Returns
Exceptions
- ArgumentException
minis not a whole number of seconds, or the settings given so far allow no offset.