File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,32 @@ public void ReactWithInitShouldReturnHtmlAndScript()
5353 "HTML" + System . Environment . NewLine + "<script>JS</script>" ,
5454 result . ToString ( )
5555 ) ;
56+ }
57+
58+ [ Test ]
59+ public void EngineIsReturnedToPoolAfterRender ( )
60+ {
61+ var component = new Mock < IReactComponent > ( ) ;
62+ component . Setup ( x => x . RenderHtml ( true , true ) ) . Returns ( "HTML" ) ;
63+ var environment = ConfigureMockEnvironment ( ) ;
64+ environment . Setup ( x => x . CreateComponent (
65+ "ComponentName" ,
66+ new { } ,
67+ null ,
68+ true
69+ ) ) . Returns ( component . Object ) ;
5670
71+ environment . Verify ( x => x . ReturnEngineToPool ( ) , Times . Never ) ;
72+ var result = HtmlHelperExtensions . React (
73+ htmlHelper : null ,
74+ componentName : "ComponentName" ,
75+ props : new { } ,
76+ htmlTag : "span" ,
77+ clientOnly : true ,
78+ serverOnly : true
79+ ) ;
80+ component . Verify ( x => x . RenderHtml ( It . Is < bool > ( y => y == true ) , It . Is < bool > ( z => z == true ) ) , Times . Once ) ;
81+ environment . Verify ( x => x . ReturnEngineToPool ( ) , Times . Once ) ;
5782 }
5883
5984 [ Test ]
You can’t perform that action at this time.
0 commit comments