Provides TimeZoneID mapping based on custom values provided by a CLDR xml file.
Inheritance: BaseTZMapper, TimeZoneMapper.TZMappers.ITZMapper
        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"));
        }
        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"));
        }
        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"));
            }
        }
 public void CustomTZMapperThrowsOnNonExistingTZID()
 {
     var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8);
     mapper.MapTZID("XXX");
 }
 public void CustomTZMapperThrowsOnNonExistingFile()
 {
     var mapper = new CustomValuesTZMapper("XXX.xml", Encoding.UTF8);
 }
 public void CustomTZMapperThrowsOnInvalidXML()
 {
     var mapper = new CustomValuesTZMapper("<xxx>");
 }
 public void CustomTZMapperThrowsOnInvalidCLDR()
 {
     var mapper = new CustomValuesTZMapper("<foo/>");
 }
 public void CustomTZMapperLoadsEmptyCLDRCorrectly()
 {
     var mapper = new CustomValuesTZMapper("<mapTimezones/>");
 }
        public void VersionAttributesAreParsedCorrectly()
        {
            var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8);

            Assert.AreEqual("zyx", mapper.TZIDVersion);
            Assert.AreEqual("xyz", mapper.TZVersion);
            Assert.AreEqual("zyx.xyz", mapper.Version);
        }
 public void CustomTZMapperDoesntContainNonExistingTimeZones()
 {
     var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8);
     mapper.MapTZID("Test/C");
 }
        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"));
        }