@@ -3624,4 +3624,45 @@ public void StringifyShouldIncludeInheritedFieldsAndProperties()
36243624        engine . SetValue ( "c" ,  new  Circle ( 12.34 ) ) ; 
36253625        engine . Evaluate ( "JSON.stringify(c)" ) . ToString ( ) . Should ( ) . Be ( "{\" Radius\" :12.34,\" Color\" :0,\" Id\" :123}" ) ; 
36263626    } 
3627+ 
3628+     public  class  Animal 
3629+     { 
3630+         public  virtual  string  name  {  get ;  set ;  }  =  "animal" ; 
3631+     } 
3632+ 
3633+     public  class  Elephant  :  Animal 
3634+     { 
3635+         public  override  string  name  {  get ;  set ;  }  =  "elephant" ; 
3636+         public  int  earSize  =  5 ; 
3637+     } 
3638+ 
3639+     public  class  Lion  :  Animal 
3640+     { 
3641+         public  override  string  name  {  get ;  set ;  }  =  "lion" ; 
3642+         public  int  maneLength  =  10 ; 
3643+     } 
3644+ 
3645+     public  class  Zoo 
3646+     { 
3647+         public  Animal  king  {  get  =>  ( new  Animal [ ]  {  new  Lion ( )  } ) [ 0 ] ;  } 
3648+         public  Animal [ ]  animals  {  get  =>  new  Animal [ ]  {  new  Lion ( ) ,  new  Elephant ( )  } ;  } 
3649+     } 
3650+ 
3651+     [ Fact ] 
3652+     public  void  CanFindDerivedPropertiesFail ( )  // Fails in 4.01 but success in 2.11 
3653+     { 
3654+         var  engine  =  new  Engine ( ) ; 
3655+         engine . SetValue ( "zoo" ,  new  Zoo ( ) ) ; 
3656+         var  kingManeLength  =  engine . Evaluate ( "zoo.King.maneLength" ) ; 
3657+         Assert . Equal ( 10 ,  kingManeLength . AsNumber ( ) ) ; 
3658+     } 
3659+ 
3660+     [ Fact ] 
3661+     public  void  CanFindDerivedPropertiesSucceed ( )  // Similar case that continues to succeed 
3662+     { 
3663+         var  engine  =  new  Engine ( ) ; 
3664+         engine . SetValue ( "zoo" ,  new  Zoo ( ) ) ; 
3665+         var  lionManeLength  =  engine . Evaluate ( "zoo.animals[0].maneLength" ) ; 
3666+         Assert . Equal ( 10 ,  lionManeLength . AsNumber ( ) ) ; 
3667+     } 
36273668} 
0 commit comments