@@ -421,7 +421,7 @@ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeWithMethod()
421421 }
422422
423423 [ Fact ]
424- public virtual void CallingOfMethodOfCustomReferenceTypeWithInterfaceParameter ( )
424+ public virtual void EmbeddingOfInstancesOfCustomReferenceTypesAndCallingOfMethodOfWithInterfaceParameter ( )
425425 {
426426 // Arrange
427427 var animalTrainer = new AnimalTrainer ( ) ;
@@ -452,6 +452,28 @@ public virtual void CallingOfMethodOfCustomReferenceTypeWithInterfaceParameter()
452452 Assert . Equal ( targetOutput2 , output2 ) ;
453453 }
454454
455+ [ Fact ]
456+ public virtual void EmbeddingOfInstanceOfCustomReferenceTypeAndCallingOfItsGetTypeMethod ( )
457+ {
458+ // Arrange
459+ var cat = new Cat ( ) ;
460+
461+ const string input = "cat.GetType();" ;
462+ string targetOutput = typeof ( Cat ) . FullName ;
463+
464+ // Act
465+ string output ;
466+
467+ using ( var jsEngine = CreateJsEngine ( ) )
468+ {
469+ jsEngine . EmbedHostObject ( "cat" , cat ) ;
470+ output = jsEngine . Evaluate < string > ( input ) ;
471+ }
472+
473+ // Assert
474+ Assert . Equal ( targetOutput , output ) ;
475+ }
476+
455477 #endregion
456478
457479 #region Delegates
@@ -586,7 +608,7 @@ public virtual void EmbeddingOfInstanceOfDelegateWithoutResult()
586608 }
587609
588610 [ Fact ]
589- public virtual void EmbeddedInstanceOfDelegateHasFunctionPrototype ( )
611+ public virtual void EmbeddingOfInstanceOfDelegateAndCheckingItsPrototype ( )
590612 {
591613 // Arrange
592614 var someFunc = new Func < int > ( ( ) => 42 ) ;
@@ -607,7 +629,7 @@ public virtual void EmbeddedInstanceOfDelegateHasFunctionPrototype()
607629 }
608630
609631 [ Fact ]
610- public virtual void CallingOfEmbeddedDelegateWithMissingParameter ( )
632+ public virtual void EmbeddingOfInstanceOfDelegateAndCallingItWithMissingParameter ( )
611633 {
612634 // Arrange
613635 var sumFunc = new Func < int , int , int > ( ( a , b ) => a + b ) ;
@@ -635,7 +657,7 @@ public virtual void CallingOfEmbeddedDelegateWithMissingParameter()
635657 }
636658
637659 [ Fact ]
638- public virtual void CallingOfEmbeddedDelegateWithExtraParameter ( )
660+ public virtual void EmbeddingOfInstanceOfDelegateAndCallingItWithExtraParameter ( )
639661 {
640662 // Arrange
641663 var sumFunc = new Func < int , int , int > ( ( a , b ) => a + b ) ;
@@ -656,6 +678,29 @@ public virtual void CallingOfEmbeddedDelegateWithExtraParameter()
656678 Assert . Equal ( targetOutput , output ) ;
657679 }
658680
681+ [ Fact ]
682+ public virtual void EmbeddingOfInstanceOfDelegateAndGettingItsMethodProperty ( )
683+ {
684+ // Arrange
685+ var cat = new Cat ( ) ;
686+ var cryFunc = new Func < string > ( cat . Cry ) ;
687+
688+ const string input = "cry.Method;" ;
689+ string targetOutput = "undefined" ;
690+
691+ // Act
692+ string output ;
693+
694+ using ( var jsEngine = CreateJsEngine ( ) )
695+ {
696+ jsEngine . EmbedHostObject ( "cry" , cryFunc ) ;
697+ output = jsEngine . Evaluate < string > ( input ) ;
698+ }
699+
700+ // Assert
701+ Assert . Equal ( targetOutput , output ) ;
702+ }
703+
659704 #endregion
660705
661706 #region Recursive calls
@@ -847,6 +892,49 @@ public virtual void CreatingAnInstanceOfEmbeddedCustomReferenceType()
847892 Assert . Equal ( targetOutput , output ) ;
848893 }
849894
895+ [ Fact ]
896+ public virtual void CreatingAnInstanceOfEmbeddedBuiltinExceptionAndGettingItsTargetSiteProperty ( )
897+ {
898+ // Arrange
899+ Type invalidOperationExceptionType = typeof ( InvalidOperationException ) ;
900+
901+ const string input = "new InvalidOperationError(\" A terrible thing happened!\" ).TargetSite;" ;
902+
903+ // Act
904+ string output ;
905+
906+ using ( var jsEngine = CreateJsEngine ( ) )
907+ {
908+ jsEngine . EmbedHostType ( "InvalidOperationError" , invalidOperationExceptionType ) ;
909+ output = jsEngine . Evaluate < string > ( input ) ;
910+ }
911+
912+ // Assert
913+ Assert . Null ( output ) ;
914+ }
915+
916+ [ Fact ]
917+ public virtual void CreatingAnInstanceOfEmbeddedCustomExceptionAndCallingOfItsGetTypeMethod ( )
918+ {
919+ // Arrange
920+ Type loginFailedExceptionType = typeof ( LoginFailedException ) ;
921+
922+ const string input = "new LoginFailedError(\" Wrong password entered!\" ).GetType();" ;
923+ string targetOutput = loginFailedExceptionType . FullName ;
924+
925+ // Act
926+ string output ;
927+
928+ using ( var jsEngine = CreateJsEngine ( ) )
929+ {
930+ jsEngine . EmbedHostType ( "LoginFailedError" , loginFailedExceptionType ) ;
931+ output = jsEngine . Evaluate < string > ( input ) ;
932+ }
933+
934+ // Assert
935+ Assert . Equal ( targetOutput , output ) ;
936+ }
937+
850938 #endregion
851939
852940 #region Types with constants
0 commit comments