Class FakeDateTimeZoneSource.Builder
Builder for FakeDateTimeZoneSource, allowing the built object to
be immutable, but constructed via object/collection initializers.
Since 1.1.x
Availability net45, netstandard1.3
Inheritance
Object
FakeDateTimeZoneSource.Builder
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime.Testing.TimeZones
Assembly: NodaTime.Testing.dll
Syntax
public sealed class Builder : IEnumerable<DateTimeZone>, IEnumerable
Constructors
Builder()
Creates a new builder.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public Builder()
Properties
BclIdsToZoneIds
Gets the dictionary mapping BCL System.TimeZoneInfo IDs to the canonical IDs
served within the provider being built.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public IDictionary<string, string> BclIdsToZoneIds { get; }
Property Value
Type | Description |
---|---|
IDictionary<String, String> | The dictionary mapping BCL IDs to the canonical IDs served within the provider being built. |
VersionId
Gets the version ID to advertise; defaults to "TestZones".
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public string VersionId { get; set; }
Property Value
Type | Description |
---|---|
String | The version ID to advertise; defaults to "TestZones". |
Zones
Gets the list of zones, exposed as a property for use when a test needs to set properties as
well as adding zones.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public IList<DateTimeZone> Zones { get; }
Property Value
Type | Description |
---|---|
IList<DateTimeZone> | The list of zones within the provider being built. |
Methods
Add(DateTimeZone)
Adds a time zone to the builder.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public void Add(DateTimeZone zone)
Parameters
Type | Name | Description |
---|---|---|
DateTimeZone | zone | The zone to add. |
Build()
Builds a time zone source from this builder. The returned
builder will be independent of this builder; further changes
to this builder will not be reflected in the returned source.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public FakeDateTimeZoneSource Build()
Returns
Type | Description |
---|---|
FakeDateTimeZoneSource | The newly-built time zone source. |
Remarks
This method performs some sanity checks, and throws exceptions if
they're violated. Those exceptions are not documented here, and you
shouldn't be catching them anyway. (This is aimed at testing...)
GetEnumerator()
Returns the zones within the builder. This mostly exists
to enable collection initializers.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
public IEnumerator<DateTimeZone> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<DateTimeZone> | An iterator over the zones in this builder. |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Explicit interface implementation of System.Collections.IEnumerator.
Since 1.1.x
Availability net45, netstandard1.3
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator | An iterator over the zones in this builder. |
Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable