2
2
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
4
4
using System ;
5
+ using System . Globalization ;
5
6
using Xunit ;
6
7
7
8
public static class TimeZoneInfoTests
@@ -19,6 +20,7 @@ public static class TimeZoneInfoTests
19
20
private static String s_strRussian = s_isWindows ? "Russian Standard Time" : "Europe/Moscow" ;
20
21
private static String s_strLibya = s_isWindows ? "Libya Standard Time" : "Africa/Tripoli" ;
21
22
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" ;
22
24
23
25
private static TimeZoneInfo s_myUtc = TimeZoneInfo . Utc ;
24
26
private static TimeZoneInfo s_myLocal = TimeZoneInfo . Local ;
@@ -27,6 +29,7 @@ public static class TimeZoneInfoTests
27
29
private static TimeZoneInfo s_nairobiTz = TimeZoneInfo . FindSystemTimeZoneById ( s_strNairobi ) ;
28
30
private static TimeZoneInfo s_amsterdamTz = TimeZoneInfo . FindSystemTimeZoneById ( s_strAmsterdam ) ;
29
31
private static TimeZoneInfo s_catamarcaTz = TimeZoneInfo . FindSystemTimeZoneById ( s_strCatamarca ) ;
32
+ private static TimeZoneInfo s_LisbonTz = TimeZoneInfo . FindSystemTimeZoneById ( s_strLisbon ) ;
30
33
31
34
private static bool s_localIsPST = TimeZoneInfo . Local . Id == s_strPacific ;
32
35
private static bool s_regLocalSupportsDST = s_regLocal . SupportsDaylightSavingTime ;
@@ -1680,6 +1683,30 @@ public static void TestCatamarcaMultiYearDaylightSavings()
1680
1683
VerifyDST ( s_catamarcaTz , new DateTime ( 1963 , 10 , 01 , 03 , 00 , 00 , DateTimeKind . Utc ) , false ) ;
1681
1684
}
1682
1685
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
+
1683
1710
//
1684
1711
// Helper Methods
1685
1712
//
0 commit comments