private static void ReadWindowsZones(DateTimeZoneReader reader) { var zones = WindowsZones.Read(reader); Console.WriteLine($" Version: {zones.Version}"); Console.WriteLine($" TZDB version: {zones.TzdbVersion}"); Console.WriteLine($" Windows version: {zones.WindowsVersion}"); Console.WriteLine($" Mappings: {zones.MapZones.Count}"); foreach (var mapZone in zones.MapZones) { Console.WriteLine($" {mapZone}"); } }
public void ReadWrite() { var zones = new WindowsZones("version", "tzdbVersion", "windowsVersion", new[] { MapZone1, MapZone2, MapZone3 }); var stream = new MemoryStream(); var writer = new DateTimeZoneWriter(stream, null); zones.Write(writer); stream.Position = 0; var reader = new DateTimeZoneReader(stream, null); var zones2 = WindowsZones.Read(reader); Assert.AreEqual("version", zones2.Version); Assert.AreEqual("tzdbVersion", zones2.TzdbVersion); Assert.AreEqual("windowsVersion", zones2.WindowsVersion); Assert.AreEqual("primaryId2", zones2.PrimaryMapping["windowsId2"]); Assert.AreEqual("primaryId3", zones2.PrimaryMapping["windowsId3"]); Assert.AreEqual(new[] { MapZone1, MapZone2, MapZone3 }, zones2.MapZones); }