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 CustomTZMapperDoesntContainNonExistingTimeZones() { var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8); mapper.MapTZID("Test/C"); }
public void CustomTZMapperThrowsOnNonExistingTZID() { var mapper = new CustomValuesTZMapper("testcldr.xml", Encoding.UTF8); mapper.MapTZID("XXX"); }
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")); }