@@ -272,5 +272,92 @@ public void Async_Method_Invocation_Support()
272272 _output . WriteLine ( "Async method testing skipped - no suitable method found" ) ;
273273 }
274274 }
275+
276+ [ Fact ]
277+ public async Task MethodWrapper_Enum_Parameter_String_Input ( )
278+ {
279+ // Arrange
280+ var reflector = new Reflector ( ) ;
281+ var methodInfo = typeof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper ) . GetMethod ( nameof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper . ProcessEnum ) ) ! ;
282+ var wrapper = MethodWrapper . Create ( reflector , null , methodInfo ) ;
283+
284+ // Act & Assert - Test with string representation of enum
285+ var parameters = new Dictionary < string , object ? >
286+ {
287+ { "enumValue" , "Option2" }
288+ } ;
289+
290+ var result = await wrapper . InvokeDict ( parameters ) ;
291+
292+ // Assert
293+ Assert . NotNull ( result ) ;
294+ Assert . Equal ( "Processed enum: Option2" , result . ToString ( ) ) ;
295+ _output . WriteLine ( $ "Enum parameter test with string input: { result } ") ;
296+ }
297+
298+ [ Fact ]
299+ public async Task MethodWrapper_Enum_Parameter_JsonElement_Input ( )
300+ {
301+ // Arrange
302+ var reflector = new Reflector ( ) ;
303+ var methodInfo = typeof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper ) . GetMethod ( nameof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper . ProcessEnum ) ) ! ;
304+ var wrapper = MethodWrapper . Create ( reflector , null , methodInfo ) ;
305+
306+ // Act & Assert - Test with JsonElement containing enum string
307+ var jsonDocument = JsonDocument . Parse ( "\" Option3\" " ) ;
308+ var jsonElement = jsonDocument . RootElement ;
309+
310+ var parameters = new Dictionary < string , object ? >
311+ {
312+ { "enumValue" , jsonElement }
313+ } ;
314+
315+ var result = await wrapper . InvokeDict ( parameters ) ;
316+
317+ // Assert
318+ Assert . NotNull ( result ) ;
319+ Assert . Equal ( "Processed enum: Option3" , result . ToString ( ) ) ;
320+ _output . WriteLine ( $ "Enum parameter test with JsonElement input: { result } ") ;
321+ }
322+
323+ [ Fact ]
324+ public async Task MethodWrapper_Enum_Parameter_Default_Value ( )
325+ {
326+ // Arrange
327+ var reflector = new Reflector ( ) ;
328+ var methodInfo = typeof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper ) . GetMethod ( nameof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper . ProcessEnumWithDefault ) ) ! ;
329+ var wrapper = MethodWrapper . Create ( reflector , null , methodInfo ) ;
330+
331+ // Act & Assert - Test with no parameter (should use default value Option2)
332+ var result = await wrapper . InvokeDict ( null ) ;
333+
334+ // Assert
335+ Assert . NotNull ( result ) ;
336+ Assert . Equal ( "Processed enum with default: Option2" , result . ToString ( ) ) ;
337+ _output . WriteLine ( $ "Enum parameter test with default value: { result } ") ;
338+ }
339+
340+ [ Fact ]
341+ public async Task MethodWrapper_Enum_Parameter_Mixed_Types ( )
342+ {
343+ // Arrange
344+ var reflector = new Reflector ( ) ;
345+ var methodInfo = typeof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper ) . GetMethod ( nameof ( com . IvanMurzak . ReflectorNet . Tests . Utils . MethodHelper . ProcessStringAndEnum ) ) ! ;
346+ var wrapper = MethodWrapper . Create ( reflector , null , methodInfo ) ;
347+
348+ // Act & Assert - Test with string and enum parameters
349+ var parameters = new Dictionary < string , object ? >
350+ {
351+ { "text" , "Hello" } ,
352+ { "enumValue" , "Option4" }
353+ } ;
354+
355+ var result = await wrapper . InvokeDict ( parameters ) ;
356+
357+ // Assert
358+ Assert . NotNull ( result ) ;
359+ Assert . Equal ( "Text: Hello, Enum: Option4" , result . ToString ( ) ) ;
360+ _output . WriteLine ( $ "Mixed parameters test with enum: { result } ") ;
361+ }
275362 }
276363}
0 commit comments