コード例 #1
0
        public void Serialization()
        {
            var location = new TzdbZoneLocation(
                60 * 3600 + 15 * 60 + 5,
                100 * 3600 + 30 * 60 + 10,
                "Country name",
                "CO",
                "Etc/MadeUpZone",
                "Comment");

            var stream = new MemoryStream();
            var writer = new DateTimeZoneWriter(stream, null);

            location.Write(writer);
            stream.Position = 0;

            var reader    = new DateTimeZoneReader(stream, null);
            var location2 = TzdbZoneLocation.Read(reader);

            Assert.AreEqual(60.25 + 5.0 / 3600, location2.Latitude, 0.000001);
            Assert.AreEqual(100.5 + 10.0 / 3600, location2.Longitude, 0.000001);
            Assert.AreEqual("Country name", location2.CountryName);
            Assert.AreEqual("CO", location2.CountryCode);
            Assert.AreEqual("Etc/MadeUpZone", location2.ZoneId);
            Assert.AreEqual("Comment", location2.Comment);
        }