File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5151 <ItemGroup >
5252 <Compile Include =" Properties\AssemblyInfo.cs" />
5353 <Compile Include =" ScriptSubject.cs" />
54+ <Compile Include =" WhenUsingGetEngine.cs" />
5455 <Content Include =" TestDiffNameRequire.js" >
5556 <CopyToOutputDirectory >Always</CopyToOutputDirectory >
5657 </Content >
Original file line number Diff line number Diff line change 1+ using NUnit . Framework ;
2+ using Should ;
3+
4+ namespace ClearScript . Manager . Test
5+ {
6+ [ TestFixture ]
7+ public class WhenUsingEngine
8+ {
9+ [ Test ]
10+ public void Script_Engine_Is_Retrieved ( )
11+ {
12+ ManagerPool . InitializeCurrentPool ( new ManualManagerSettings { RuntimeMaxCount = 2 } ) ;
13+
14+ using ( var scope = new ManagerScope ( ) )
15+ {
16+ var engine = scope . RuntimeManager . GetEngine ( ) ;
17+
18+ engine . ShouldNotBeNull ( ) ;
19+
20+ engine . Execute ( "var i = 200;" ) ;
21+
22+ Assert . AreEqual ( 200 , engine . Script . i ) ;
23+ }
24+
25+ }
26+ }
27+ }
Original file line number Diff line number Diff line change @@ -99,6 +99,12 @@ public interface IRuntimeManager : IDisposable
9999 /// <returns>Bool indicating that cached script was located.</returns>
100100 bool TryGetCached ( string scriptId , out CachedV8Script script ) ;
101101
102+ /// <summary>
103+ /// Retrieves the script engine for the current runtime manager.
104+ /// </summary>
105+ /// <returns></returns>
106+ V8ScriptEngine GetEngine ( ) ;
107+
102108 /// <summary>
103109 /// Cleans up resources in the current runtime.
104110 /// </summary>
You can’t perform that action at this time.
0 commit comments