示例#1
0
        public void CustomTZMapperStringConstructorPassingPath()
        {
            var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8);

            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("UTC"), mapper.MapTZID("Test/A"));
            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"), mapper.MapTZID("Test/B"));
        }
示例#2
0
        public void CustomTZMapperStringConstructorPassingXML()
        {
            var mapper = new CustomValuesTZMapper(File.ReadAllText("testcldr.xml"));

            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("UTC"), mapper.MapTZID("Test/A"));
            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"), mapper.MapTZID("Test/B"));
        }
示例#3
0
        public void CustomTZMapperStringConstructorPassingStream()
        {
            using (var stream = File.Open("testcldr.xml", FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                var mapper = new CustomValuesTZMapper(stream);

                Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("UTC"), mapper.MapTZID("Test/A"));
                Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"), mapper.MapTZID("Test/B"));
            }
        }
示例#4
0
        public void CustomTZMapperDoesntContainNonExistingTimeZones()
        {
            var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8);

            mapper.MapTZID("Test/C");
        }
示例#5
0
        public void CustomTZMapperThrowsOnNonExistingTZID()
        {
            var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8);

            mapper.MapTZID("XXX");
        }
示例#6
0
        public void SpaceSeparatedTimeZonesAreParsedCorrectly()
        {
            var mapper = new CustomValuesTZMapper(File.ReadAllText("testcldr.xml"));

            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"), mapper.MapTZID("America/Anchorage"));
            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"), mapper.MapTZID("America/Juneau"));
            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"), mapper.MapTZID("America/Nome"));
            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"), mapper.MapTZID("America/Sitka"));
            Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Alaskan Standard Time"), mapper.MapTZID("America/Yakutat"));
        }