public void All_Windows_Timezones_Should_Be_Convertable_To_Iana() { var allTimezones = TimezoneHelper.GetWindowsTimeZoneIds(); Should.NotThrow(() => { var exceptions = new List <string>(); foreach (var timezone in allTimezones) { try { TimezoneHelper.WindowsToIana(timezone); } catch (Exception ex) { exceptions.Add(ex.Message); } } if (exceptions.Any()) { throw new Exception(exceptions.JoinAsString(Environment.NewLine)); } }); }
public List <NameValueDto> GetWindowsTimezones() { return(TimezoneHelper.GetWindowsTimeZoneIds().Select(TimezoneHelper.FindTimeZoneInfo).OrderBy(tz => tz.BaseUtcOffset) .Select(tz => new NameValueDto { Value = tz.Id, Name = tz.DisplayName }).ToList()); }