@@ -1041,6 +1041,18 @@ public static void Parse_InvalidArguments_Throws()
1041
1041
Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "" ) ) ;
1042
1042
Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "" , new MyFormatter ( ) ) ) ;
1043
1043
Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "" , new MyFormatter ( ) , DateTimeStyles . NoCurrentDateDefault ) ) ;
1044
+
1045
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000-07:00c" ) ) ;
1046
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000-07:00c" , new MyFormatter ( ) ) ) ;
1047
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000-07:00c" , new MyFormatter ( ) , DateTimeStyles . NoCurrentDateDefault ) ) ;
1048
+
1049
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000+00:00#" ) ) ;
1050
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000+00:00#" , new MyFormatter ( ) ) ) ;
1051
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000+00:00#" , new MyFormatter ( ) , DateTimeStyles . NoCurrentDateDefault ) ) ;
1052
+
1053
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000+00:00#\0 " ) ) ;
1054
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000+00:00#\0 " , new MyFormatter ( ) ) ) ;
1055
+ Assert . Throws < FormatException > ( ( ) => DateTime . Parse ( "2020-5-7T09:37:00.0000000+00:00#\0 " , new MyFormatter ( ) , DateTimeStyles . NoCurrentDateDefault ) ) ;
1044
1056
}
1045
1057
1046
1058
[ Theory ]
@@ -1711,6 +1723,11 @@ public static IEnumerable<object[]> Parse_ValidInput_Succeeds_MemberData()
1711
1723
yield return new object [ ] { "2 2 2Z" , CultureInfo . InvariantCulture , TimeZoneInfo . ConvertTimeFromUtc ( new DateTime ( 2002 , 2 , 2 , 0 , 0 , 0 , DateTimeKind . Utc ) , TimeZoneInfo . Local ) } ;
1712
1724
yield return new object [ ] { "#10/10/2095#\0 " , CultureInfo . InvariantCulture , new DateTime ( 2095 , 10 , 10 , 0 , 0 , 0 ) } ;
1713
1725
1726
+ yield return new object [ ] { "2020-5-7T09:37:00.0000000+00:00\0 " , CultureInfo . InvariantCulture , TimeZoneInfo . ConvertTimeFromUtc ( new DateTime ( 2020 , 5 , 7 , 9 , 37 , 0 , DateTimeKind . Utc ) , TimeZoneInfo . Local ) } ;
1727
+ yield return new object [ ] { "#2020-5-7T09:37:00.0000000+00:00#" , CultureInfo . InvariantCulture , TimeZoneInfo . ConvertTimeFromUtc ( new DateTime ( 2020 , 5 , 7 , 9 , 37 , 0 , DateTimeKind . Utc ) , TimeZoneInfo . Local ) } ;
1728
+ yield return new object [ ] { "#2020-5-7T09:37:00.0000000+00:00#\0 " , CultureInfo . InvariantCulture , TimeZoneInfo . ConvertTimeFromUtc ( new DateTime ( 2020 , 5 , 7 , 9 , 37 , 0 , DateTimeKind . Utc ) , TimeZoneInfo . Local ) } ;
1729
+ yield return new object [ ] { "2020-5-7T09:37:00.0000000+00:00" , CultureInfo . InvariantCulture , TimeZoneInfo . ConvertTimeFromUtc ( new DateTime ( 2020 , 5 , 7 , 9 , 37 , 0 , DateTimeKind . Utc ) , TimeZoneInfo . Local ) } ;
1730
+
1714
1731
if ( PlatformDetection . IsNotInvariantGlobalization )
1715
1732
{
1716
1733
DateTime today = DateTime . Today ;
0 commit comments