Skip to content

Commit

Permalink
Fix tests errors
Browse files Browse the repository at this point in the history
  • Loading branch information
j-troc authored and j-troc committed Feb 24, 2020
1 parent 1263254 commit 1bcaaf7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions source/icu.net.tests/CalendarTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,31 +465,40 @@ public void AmPmTest()
[Test]
public void SetTimeZone2Test()
{
var tzdbId = "Europe/Paris";
var winId = "Romance Standard Time";
var expected = "Europe/Paris";
var timezone = TimeZoneInfo.FindSystemTimeZoneById(winId);

var timezones = TimeZoneInfo.GetSystemTimeZones();

var timezone = timezones.FirstOrDefault(tzi => tzi.Id == tzdbId);
if(timezone==null)
{
timezone = timezones.First(tzi => tzi.Id == winId);
}

using (var cal = new GregorianCalendar(new TimeZone("UTC")))
{
cal.SetTimeZone(timezone);

var tz = cal.GetTimeZone();

Assert.AreEqual(expected, tz.Id);
Assert.AreEqual(tzdbId, tz.Id);
}
}

[Test]
public void GetTimeZoneInfoTest()
{
var timezone = new TimeZone("Europe/Zagreb");
var expected = "Central European Standard Time";
var tzdbId = "Europe/Zagreb";
var winId = "Central European Standard Time";

var timezone = new TimeZone(tzdbId);

using (var cal = new GregorianCalendar(timezone))
{
var tz = cal.GetTimeZoneInfo();
var result = cal.GetTimeZoneInfo();

Assert.AreEqual(expected, tz.Id);
Assert.IsTrue(result.Id == winId || result.Id == tzdbId);
}
}

Expand Down

0 comments on commit 1bcaaf7

Please sign in to comment.