Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 9406f90

Browse files
author
Eric Erhardt
committed
Adding an additional test for Europe/Lisbon in 1996.
Portugal made a transition from standard to DST without changing the UTC offset in 1996. Adding a test to verify this is correctly represented.
1 parent 153ec68 commit 9406f90

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/System.Runtime/tests/System/TimeZoneInfo.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System;
5+
using System.Globalization;
56
using Xunit;
67

78
public static class TimeZoneInfoTests
@@ -19,6 +20,7 @@ public static class TimeZoneInfoTests
1920
private static String s_strRussian = s_isWindows ? "Russian Standard Time" : "Europe/Moscow";
2021
private static String s_strLibya = s_isWindows ? "Libya Standard Time" : "Africa/Tripoli";
2122
private static String s_strCatamarca = s_isWindows ? "Argentina Standard Time" : "America/Catamarca";
23+
private static String s_strLisbon = Interop.IsWindows ? "GMT Standard Time" : "Europe/Lisbon";
2224

2325
private static TimeZoneInfo s_myUtc = TimeZoneInfo.Utc;
2426
private static TimeZoneInfo s_myLocal = TimeZoneInfo.Local;
@@ -27,6 +29,7 @@ public static class TimeZoneInfoTests
2729
private static TimeZoneInfo s_nairobiTz = TimeZoneInfo.FindSystemTimeZoneById(s_strNairobi);
2830
private static TimeZoneInfo s_amsterdamTz = TimeZoneInfo.FindSystemTimeZoneById(s_strAmsterdam);
2931
private static TimeZoneInfo s_catamarcaTz = TimeZoneInfo.FindSystemTimeZoneById(s_strCatamarca);
32+
private static TimeZoneInfo s_LisbonTz = TimeZoneInfo.FindSystemTimeZoneById(s_strLisbon);
3033

3134
private static bool s_localIsPST = TimeZoneInfo.Local.Id == s_strPacific;
3235
private static bool s_regLocalSupportsDST = s_regLocal.SupportsDaylightSavingTime;
@@ -1680,6 +1683,30 @@ public static void TestCatamarcaMultiYearDaylightSavings()
16801683
VerifyDST(s_catamarcaTz, new DateTime(1963, 10, 01, 03, 00, 00, DateTimeKind.Utc), false);
16811684
}
16821685

1686+
[Theory]
1687+
[PlatformSpecific(PlatformID.AnyUnix)]
1688+
// in 1996 Europe/Lisbon changed from standard time to DST without changing the UTC offset
1689+
[InlineData("1995-09-30T17:00:00.0000000Z", false, "1:00:00")]
1690+
[InlineData("1996-03-31T00:59:59.0000000Z", false, "1:00:00")]
1691+
[InlineData("1996-03-31T01:00:00.0000000Z", true, "1:00:00")]
1692+
[InlineData("1996-03-31T01:00:01.0000000Z", true, "1:00:00")]
1693+
[InlineData("1996-03-31T11:00:01.0000000Z", true, "1:00:00")]
1694+
[InlineData("1996-08-31T11:00:00.0000000Z", true, "1:00:00")]
1695+
[InlineData("1996-10-27T00:00:00.0000000Z", true, "1:00:00")]
1696+
[InlineData("1996-10-27T00:59:59.0000000Z", true, "1:00:00")]
1697+
[InlineData("1996-10-27T01:00:00.0000000Z", false, "0:00:00")]
1698+
[InlineData("1996-10-28T01:00:00.0000000Z", false, "0:00:00")]
1699+
[InlineData("1997-03-30T00:59:59.0000000Z", false, "0:00:00")]
1700+
[InlineData("1997-03-30T01:00:00.0000000Z", true, "1:00:00")]
1701+
public static void TestLisbonDaylightSavingsWithNoOffsetChange(string dateTimeString, bool expectedDST, string expectedOffsetString)
1702+
{
1703+
DateTime dt = DateTime.ParseExact(dateTimeString, "o", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
1704+
VerifyDST(s_LisbonTz, dt, expectedDST);
1705+
1706+
TimeSpan offset = TimeSpan.Parse(expectedOffsetString, CultureInfo.InvariantCulture);
1707+
Assert.Equal(offset, s_LisbonTz.GetUtcOffset(dt));
1708+
}
1709+
16831710
//
16841711
// Helper Methods
16851712
//

0 commit comments

Comments
 (0)