Noda Time
Show / Hide Table of Contents

Class FakeDateTimeZoneSource

A time zone source for test purposes. Create instances via FakeDateTimeZoneSource.Builder.
Since 1.1.x
Availability netstandard2.0
Inheritance
Object
FakeDateTimeZoneSource
Implements
IDateTimeZoneSource
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: NodaTime.Testing.TimeZones
Assembly: NodaTime.Testing.dll
Syntax
public sealed class FakeDateTimeZoneSource : IDateTimeZoneSource

Properties

VersionId

Returns an appropriate version ID for diagnostic purposes, which must not be null.
Since 1.1.x
Availability netstandard2.0
Declaration
public string VersionId { get; }
Property Value
Type Description
String An appropriate version ID for diagnostic purposes.
Remarks
This doesn't have any specific format; it's solely for diagnostic purposes. The included sources return strings of the format "source identifier: source version" indicating where the information comes from and which version of the source information has been loaded.

Methods

ForId(String)

Returns the time zone definition associated with the given ID.
Since 1.1.x
Availability netstandard2.0
Declaration
public DateTimeZone ForId(string id)
Parameters
Type Name Description
String id The ID of the time zone to return. This must be one of the IDs returned by GetIds().
Returns
Type Description
DateTimeZone The DateTimeZone for the given ID.
Exceptions
Type Condition
System.ArgumentException id is not supported by this source.

GetIds()

Returns an unordered enumeration of the IDs available from this source.
Since 1.1.x
Availability netstandard2.0
Declaration
public IEnumerable<string> GetIds()
Returns
Type Description
IEnumerable<String> The IDs available from this source.
Remarks

Every value in this enumeration must return a valid time zone from ForId(String) for the life of the source. The enumeration may be empty, but must not be null, and must not contain any elements which are null. It should not contain duplicates: this is not enforced, and while it may not have a significant impact on clients in some cases, it is generally unfriendly. The built-in implementations never return duplicates.

The source is not required to provide the IDs in any particular order, although they should be distinct.

Note that this list may optionally contain any of the fixed-offset timezones (with IDs "UTC" and "UTC+/-Offset"), but there is no requirement they be included.

GetSystemDefaultId()

Returns this source's ID for the system default time zone.
Since 2.0.x
Availability netstandard2.0
Declaration
public string GetSystemDefaultId()
Returns
Type Description
String The ID for the system default time zone for this source, or null if the system default time zone has no mapping in this source.

ToProvider()

Creates a time zone provider (DateTimeZoneCache) from this source.
Since 1.1.x
Availability netstandard2.0
Declaration
public IDateTimeZoneProvider ToProvider()
Returns
Type Description
IDateTimeZoneProvider A provider backed by this source.

Implements

IDateTimeZoneSource
In this article
Back to top Generated by DocFX