@@ -378,4 +378,81 @@ await context.Script.CallFunctionAsync($$"""
378378 """ , false , new ( ) { Arguments = [ arg ] } ) ;
379379 } , Throws . Nothing ) ;
380380 }
381+
382+ [ Test ]
383+ public void CanConvertNullBoolToLocalValue ( )
384+ {
385+ bool ? arg = null ;
386+ LocalValue result = ( LocalValue ) arg ;
387+ Assert . That ( result , Is . TypeOf < NullLocalValue > ( ) ) ;
388+ }
389+
390+ [ Test ]
391+ public void CanConvertTrueToLocalValue ( )
392+ {
393+ bool arg = true ;
394+ LocalValue result = ( LocalValue ) arg ;
395+ Assert . That ( result , Is . TypeOf < BooleanLocalValue > ( ) ) ;
396+ Assert . That ( ( result as BooleanLocalValue ) . Value , Is . True ) ;
397+ }
398+
399+ [ Test ]
400+ public void CanConvertFalseToLocalValue ( )
401+ {
402+ bool arg = false ;
403+ LocalValue result = ( LocalValue ) arg ;
404+ Assert . That ( result , Is . TypeOf < BooleanLocalValue > ( ) ) ;
405+ Assert . That ( ( result as BooleanLocalValue ) . Value , Is . False ) ;
406+ }
407+
408+ [ Test ]
409+ public void CanConvertNullIntToLocalValue ( )
410+ {
411+ int ? arg = null ;
412+ LocalValue result = ( LocalValue ) arg ;
413+ Assert . That ( result , Is . TypeOf < NullLocalValue > ( ) ) ;
414+ }
415+
416+ [ Test ]
417+ public void CanConvertZeroIntToLocalValue ( )
418+ {
419+ int arg = 0 ;
420+ LocalValue result = ( LocalValue ) arg ;
421+ Assert . That ( result , Is . TypeOf < NumberLocalValue > ( ) ) ;
422+ Assert . That ( ( result as NumberLocalValue ) . Value , Is . Zero ) ;
423+ }
424+
425+ [ Test ]
426+ public void CanConvertNullDoubleToLocalValue ( )
427+ {
428+ double ? arg = null ;
429+ LocalValue result = ( LocalValue ) arg ;
430+ Assert . That ( result , Is . TypeOf < NullLocalValue > ( ) ) ;
431+ }
432+
433+ [ Test ]
434+ public void CanConvertZeroDoubleToLocalValue ( )
435+ {
436+ double arg = 0 ;
437+ LocalValue result = ( LocalValue ) arg ;
438+ Assert . That ( result , Is . TypeOf < NumberLocalValue > ( ) ) ;
439+ Assert . That ( ( result as NumberLocalValue ) . Value , Is . Zero ) ;
440+ }
441+
442+ [ Test ]
443+ public void CanConvertNullStringToLocalValue ( )
444+ {
445+ string arg = null ;
446+ LocalValue result = ( LocalValue ) arg ;
447+ Assert . That ( result , Is . TypeOf < NullLocalValue > ( ) ) ;
448+ }
449+
450+ [ Test ]
451+ public void CanConvertStringToLocalValue ( )
452+ {
453+ string arg = "value" ;
454+ LocalValue result = ( LocalValue ) arg ;
455+ Assert . That ( result , Is . TypeOf < StringLocalValue > ( ) ) ;
456+ Assert . That ( ( result as StringLocalValue ) . Value , Is . EqualTo ( arg ) ) ;
457+ }
381458}
0 commit comments