Пример #1
0
        public void CreateScope_GetEngineWithNoLanguage()
        {
            var runtime = ScriptRuntimeTest.CreateRuntime();
            var scope   = runtime.CreateScope();

            Assert.AreNotEqual(scope.Engine, null);
        }
Пример #2
0
        public void Create_PassUnloadedAppDomain()
        {
            AppDomain otherAD = TestHelpers.CreateAppDomain("SecondAppDomain");

            //this call is not really needed, but let's have it and use it to check if the domain was
            //created properly and we were able to execute a create call successfully
            ScriptRuntime runtime1 = ScriptRuntimeTest.CreateRuntime(otherAD);

            AppDomain.Unload(otherAD);

            // This should throw
            ScriptRuntime runtime2 = ScriptRuntimeTest.CreateRuntime(otherAD);
        }
Пример #3
0
        public void GetVariableAsHandle_RemoteEngineRemoteValue()
        {
            ScriptRuntime env    = ScriptRuntimeTest.CreateRuntime(TestHelpers.CreateAppDomain("new domain"));
            ScriptEngine  engine = env.GetEngine("py");

            ScriptScope  scope = engine.CreateScope();
            ScriptSource code  = engine.CreateScriptSourceFromString("two=1+1", SourceCodeKind.Statements);

            code.Execute(scope);

            ObjectHandle obj = scope.GetVariableHandle("two");

            int two = (int)obj.Unwrap();

            Assert.AreEqual(two, 2);
        }
Пример #4
0
 public void Create_NullAppDomain()
 {
     ScriptRuntimeTest.CreateRuntime(null);
 }