@@ -127,17 +127,31 @@ public static void Parse<T>(string value, bool ignoreCase, T expected) where T :
127127T result ;
128128if ( ! ignoreCase )
129129{
130+ Assert . True ( Enum . TryParse ( value . AsSpan ( ) , out result ) ) ;
131+ Assert . Equal ( expected , result ) ;
132+
130133Assert . True ( Enum . TryParse ( value , out result ) ) ;
131134Assert . Equal ( expected , result ) ;
132135
136+
137+ Assert . Equal ( expected , Enum . Parse ( expected . GetType ( ) , value . AsSpan ( ) ) ) ;
133138Assert . Equal ( expected , Enum . Parse ( expected . GetType ( ) , value ) ) ;
139+
140+ Assert . Equal ( expected , Enum . Parse < T > ( value . AsSpan ( ) ) ) ;
134141Assert . Equal ( expected , Enum . Parse < T > ( value ) ) ;
135142}
136143
144+ Assert . True ( Enum . TryParse ( value . AsSpan ( ) , ignoreCase , out result ) ) ;
145+ Assert . Equal ( expected , result ) ;
146+
137147Assert . True ( Enum . TryParse ( value , ignoreCase , out result ) ) ;
138148Assert . Equal ( expected , result ) ;
139149
150+
151+ Assert . Equal ( expected , Enum . Parse ( expected . GetType ( ) , value . AsSpan ( ) , ignoreCase ) ) ;
140152Assert . Equal ( expected , Enum . Parse ( expected . GetType ( ) , value , ignoreCase ) ) ;
153+
154+ Assert . Equal ( expected , Enum . Parse < T > ( value . AsSpan ( ) , ignoreCase ) ) ;
141155Assert . Equal ( expected , Enum . Parse < T > ( value , ignoreCase ) ) ;
142156}
143157
@@ -238,10 +252,16 @@ private static void Parse_Generic_Invalid<T>(Type enumType, string value, bool i
238252Assert . False ( Enum . TryParse ( enumType , value , out result ) ) ;
239253Assert . Equal ( default ( object ) , result ) ;
240254
255+ if ( value != null )
256+ Assert . Throws ( exceptionType , ( ) => Enum . Parse < T > ( value . AsSpan ( ) ) ) ;
257+
241258Assert . Throws ( exceptionType , ( ) => Enum . Parse < T > ( value ) ) ;
242259}
243260else
244261{
262+ if ( value != null )
263+ Assert . Throws ( exceptionType , ( ) => Enum . TryParse ( enumType , value . AsSpan ( ) , out result ) ) ;
264+
245265Assert . Throws ( exceptionType , ( ) => Enum . TryParse ( enumType , value , out result ) ) ;
246266Assert . Equal ( default ( object ) , result ) ;
247267}
@@ -252,10 +272,16 @@ private static void Parse_Generic_Invalid<T>(Type enumType, string value, bool i
252272Assert . False ( Enum . TryParse ( enumType , value , ignoreCase , out result ) ) ;
253273Assert . Equal ( default ( object ) , result ) ;
254274
275+ if ( value != null )
276+ Assert . Throws ( exceptionType , ( ) => Enum . Parse < T > ( value . AsSpan ( ) , ignoreCase ) ) ;
277+
255278Assert . Throws ( exceptionType , ( ) => Enum . Parse < T > ( value , ignoreCase ) ) ;
256279}
257280else
258281{
282+ if ( value != null )
283+ Assert . Throws ( exceptionType , ( ) => Enum . TryParse ( enumType , value . AsSpan ( ) , ignoreCase , out result ) ) ;
284+
259285Assert . Throws ( exceptionType , ( ) => Enum . TryParse ( enumType , value , ignoreCase , out result ) ) ;
260286Assert . Equal ( default ( object ) , result ) ;
261287}